Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anyone using python-socketio with sanic? #356

Closed
qwexvf opened this issue Jan 27, 2017 · 5 comments
Closed

anyone using python-socketio with sanic? #356

qwexvf opened this issue Jan 27, 2017 · 5 comments
Labels

Comments

@qwexvf
Copy link

qwexvf commented Jan 27, 2017

Hi, i'm sorry that this is not even a issue. i was wondering if anyone has tried http://python-socketio.readthedocs.io/en/latest/ with sanic.

@amsb
Copy link

amsb commented Jan 27, 2017

I don't think that library is asyncio. For asyncio WebSockets, you might want to look at:

https://websockets.readthedocs.io/en/stable/

There's some interest in creating a sanic extension for web sockets in issue #12.

@seemethere
Copy link
Member

closing in favor of #12

@miguelgrinberg
Copy link
Contributor

miguelgrinberg commented Feb 20, 2017

Author of python-socketio here. I have recently added support for asyncio, and have implemented integrations for aiohttp and sanic. The aiohttp integration supports long-polling and websocket. Sanic only supports long-polling.

Here are a couple of examples for sanic: https://github.com/miguelgrinberg/python-socketio/tree/master/examples/sanic.

@mavahedinia
Copy link

@miguelgrinberg I tried to use sanic with socketio, but whenever I try to start sanic with multiple workers, the socket crashes and no connection is made! what is the solution?

@miguelgrinberg
Copy link
Contributor

You need to use a single worker process. The SocketIO is a stateful service, it cannot work with multiple workers. The alternative is to start several single-process servers, and put them behind a reverse proxy such as nginx configured with sticky sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants