Python implementation of the Socket.IO realtime server.
Features
Fully compatible with the Javascript, Swift, C++ and Java official Socket.IO clients, plus any third party clients that comply with the Socket.IO specification.
Compatible with Python 2.7 and Python 3.3+.
Supports large number of clients even on modest hardware when used with an asynchronous server based on eventlet or gevent. For development and testing, any WSGI complaint multi-threaded server can be used.
Includes a WSGI middleware that integrates Socket.IO traffic with standard WSGI applications.
Broadcasting of messages to all connected clients, or to subsets of them assigned to “rooms”.
Optional support for multiple servers, connected through a messaging queue such as Redis or RabbitMQ.
Send messages to clients from external processes, such as Celery workers or auxiliary scripts.
Event-based architecture implemented with decorators that hides the details of the protocol.
Support for HTTP long-polling and WebSocket transports.
Support for XHR2 and XHR browsers.
Support for text and binary messages.
Support for gzip and deflate HTTP compression.
Configurable CORS responses, to avoid cross-origin problems with browsers.
Example
The following application uses Flask to serve the HTML/Javascript to the client:
import socketio
import eventlet
import eventlet.wsgi
from flask import Flask, render_template
sio = socketio.Server()
app = Flask(__name__)
@app.route('/')
def index():
"""Serve the client-side application."""
return render_template('index.html')
@sio.on('connect', namespace='/chat')
def connect(sid, environ):
print("connect ", sid)
@sio.on('chat message', namespace='/chat')
def message(sid, data):
print("message ", data)
sio.emit('reply', room=sid)
@sio.on('disconnect', namespace='/chat')
def disconnect(sid):
print('disconnect ', sid)
if __name__ == '__main__':
# wrap Flask application with engineio's middleware
app = socketio.Middleware(sio, app)
# deploy as an eventlet WSGI server
eventlet.wsgi.server(eventlet.listen(('', 8000)), app)
Resources
Metadata
Release files for python-socketio 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-socketio-1.5.1.tar.gz | 14.7 kB | Without provenance | Details |
Release files / python-socketio-1.5.1.tar.gz
| Download URL | python-socketio-1.5.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b2ec154517c174b319a6fc19d8a2b6bd195ae02787ec1ebfa92f18a56750b15
|
|
BLAKE2b-256 checksum How to use checksums |
1a4bc7f3eff3bc0635dc574f5e2d5eb9d10eae3b3d2f6801cb87ff196e14e951
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-socketio 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.