Comments (3)
The role of the Flask app is to serve the client application to the browser. If you have a client that knows how to talk Socket.IO already, then you can remove all the Flask stuff from the example.
What if I want to use something else than Flask ?
Absolutely. The WSGI middleware included with this package can help you route traffic between a standard WSGI app and the Socket.IO server:
application = socketio.Middleware(sio, <your-favorite-wsgi-app-here>)
And if you don't want a WSGI app, just use the same middleware, but don't set the WSGI app:
application = socketio.Middleware(sio)
In both cases, application
can be used with one of the supported WSGI servers.
In case this isn't clear, there is another package of mine called Flask-SocketIO that uses this package as a dependency and does have very strong ties to Flask. If you were to use Flask then Flask-SocketIO provides a good integration with the frameork, so that you can share user sessions between HTTP and socket routes, for example. This package does not have any of that, Flask is actually not a dependency (it is only for the example, for the reasons stated above).
from python-socketio.
This project is not Flask specific, what makes you think you need Flask to use it?
from python-socketio.
I come from an ancient world of real time communications, using RTMP as protocol. There, you had the server that listened to 80 or 1935, it did not need a web app framework, the app logic was implemented through on_connect
type of life-cycle.
In the example code, I really do not understand the role of the Flask application, I mean, I would like to use python-socketio
as a pure websocket server and I did not find how. What if I want to use something else than Flask ?
from python-socketio.
Related Issues (20)
- May need to remove "pip install aioredis" from the documentation
- 5.10.0: pytest is failing HOT 4
- `max_http_buffer_size` value seem ignored by the server HOT 14
- Implementing `__enter__`/`__exit__` on `Client` like `SimpleClient` HOT 2
- Request: type hints (e.g. for mypy) HOT 3
- sio.disconnect() will connect after a connection drop HOT 21
- Update documentation of usage with Gunicorn + gevent/eventlet HOT 5
- Wildcard / catch-all namespace for event handlers HOT 1
- Heroku Problems with Gevent (Request Timeout + Polling Hanging)
- Concurrent broadcasting HOT 2
- All connections stop processing events at the same time
- Session not found when using sio.transport(sid) due to wrong session id HOT 1
- _ping background task not cancelled by async_server.shutdown() HOT 1
- Option to reconnect on initial connection failure
- Value error : Invalid aysnc_mode specified HOT 2
- Python socket ids for client and server dont match. HOT 6
- AsyncServer disconnect event not sent with `aiohttp>=3.9.0` HOT 2
- Test failure with .helpers import AsyncMock HOT 1
- Unable to cancel asynchronous task while client is reconnecting HOT 2
- Namespace catch-all logic HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-socketio.