Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roma-glushko/socket.io-redis-emitter
⚡️ An async Redis-based Socket.IO emitter for Python.
https://github.com/roma-glushko/socket.io-redis-emitter
socket-io socketio socketio-emitter socketio-python socketio-redis
Last synced: 2 months ago
JSON representation
⚡️ An async Redis-based Socket.IO emitter for Python.
- Host: GitHub
- URL: https://github.com/roma-glushko/socket.io-redis-emitter
- Owner: roma-glushko
- Created: 2022-03-23T19:56:19.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-09T09:21:40.000Z (7 months ago)
- Last Synced: 2024-10-10T19:39:23.765Z (3 months ago)
- Topics: socket-io, socketio, socketio-emitter, socketio-python, socketio-redis
- Language: Python
- Homepage:
- Size: 56.6 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Socket.IO Redis Emitter
This is an asynchronous Redis-based [Socket.IO emitter](https://socket.io/docs/v4/emitting-events/) for Python.
## Installation
```bash
pip install socket.io-redis-emitter
# or
poetry add socket.io-redis-emitter
```## Features
- High quality, typed and modern Python codebase
- Clean, concise and Pythonic API
- Uses [redis](https://redis.readthedocs.io/en/latest/) as a Redis client
- Supports namespaces, rooms and regular Socket.IO message emitting```python
import redis
from socketio_emitter import Emitterclient = redis.Redis(...)
emitter = Emitter(client=client)async with emitter.namespace("/nsp") as nsp:
async with nsp.rooms("room1", "room2") as clients:
await clients.emit("machineStatus", {"status": "ok"})
```- Remote requests to join, leave rooms or to disconnect
```python
import redis
from socketio_emitter import Emitterclient = redis.Redis(...)
emitter = Emitter(client=client)async with emitter.namespace("/nsp") as nsp:
async with nsp.rooms("room1", "room2") as clients:
await clients.join("room3")
# await clients.leave("room3")
# await clients.disconnect()
```