GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GAE websockets support flask-socketio · Issue #2196 · GoogleCloudPlatform/python-docs-samples

GAE websockets support flask-socketio #2196

New issue
Copy link
New issue
Copy link
Closed
Closed
GAE websockets support flask-socketio#2196
Copy link
Assignees
andrewsg
Labels
🚨This issue needs some love.api: appengineIssues related to the App Engine Admin API API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@Altiire
Altiire
opened on Jun 6, 2019
Issue body actions

In which file did you encounter the issue?

app.yaml

Did you change the file? If so, how?

Nope

Describe the issue

My project is using Flask-Socketio for websocket support.
My entrypoint is: entrypoint: gunicorn supervisor.wsgi:app -k eventlet
I also set network: session_affinity: true

Everything is running except the websocket, I get the following error on Firefox:
Firefox can’t establish a connection to the server at wss://myproject.appspot.com/socket.io/?EIO=3&transport=websocket&sid=500afafea543442dad546cc325ce5def.

There is no such error when running my project with the same command on my computer.

Activity

  1. sgreenberg
    assigned
    pfritzsche
    and
    amcasari
    and unassigned
    pfritzsche
    on Jun 7, 2019
  2. amcasari
    assigned
    andrewsg
    and unassigned
    amcasari
    on Sep 3, 2019
  3. andrewsg commented on Sep 3, 2019

    @andrewsg
    andrewsg
    on Sep 3, 2019
    Member
    More actions

    The samples are built around flask-sockets so that we can leverage the gunicorn flask_sockets.worker, which allows gunicorn to simultaneously serve http and websocket traffic. I don't think socketio on Python is compatible with gunicorn out of the box; you may have to explore alternative webservers to make this work.

    I don't know why it's working on your local machine, though. What command are you running locally to start the server?

  4. Altiire commented on Sep 4, 2019

    @Altiire
    Altiire
    on Sep 4, 2019
    Author
    More actions

    To support web sockets :

    python supervisor/app.py
    

    sample of supervisor/app.py

    def create_app(testing=False, cli=False):
        """Application factory, used to create application
        """
        app = Flask('supervisor')
        CORS(app)
        app.config.from_object('supervisor.config')
    
        if testing is True:
            app.config['TESTING'] = True
    
        force_auto_coercion()
        configure_extensions(app, cli)
        register_blueprints(app)
    
        socketio.init_app(app)
    
        return app
    
    if __name__ == '__main__':
        app = create_app()
        socketio.run(app)

    If I remember well, the socket was working on GAE in July, and not now as I just checked

    I don't think socketio on Python is compatible with gunicorn out of the box; you may have to explore alternative webservers to make this work.

    The eventlet worker is supposed to support socketio

  5. JustinBeckwith
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Oct 3, 2019
  6. leahecole
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    and removed
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Nov 15, 2019
  7. JustinBeckwith
    added
    api: appengineIssues related to the App Engine Admin API API.
    on Nov 16, 2019
  8. yoshi-automation
    added
    🚨This issue needs some love.
    on Dec 3, 2019
  9. andrewsg commented on Mar 9, 2020

    @andrewsg
    andrewsg
    on Mar 9, 2020
    Member
    More actions

    Closing this as we don't currently have a good solution for adding support for both socketio and other strategies in the same sample on Python, and it's not a bug in an existing sample.

  10. andrewsg
    closed this as completedon Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @andrewsg
    andrewsg

Labels

🚨This issue needs some love.api: appengineIssues related to the App Engine Admin API API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.