Skip to content
Discussion options

You must be logged in to vote

Since broadcaster and fastapi-socketio are archived, here are the actively maintained options in 2026:

Recommended Solutions

1. python-socketio (Most Popular)

pip install python-socketio
import socketio
from fastapi import FastAPI

sio = socketio.AsyncServer(async_mode='asgi', cors_allowed_origins='*')
app = FastAPI()
socket_app = socketio.ASGIApp(sio, app)

@sio.event
async def connect(sid, environ):
    print(f"Client connected: {sid}")

@sio.event
async def message(sid, data):
    await sio.emit('response', {'data': data}, room=sid)

For horizontal scaling, use Redis adapter:

import socketio

mgr = socketio.AsyncRedisManager('redis://localhost:6379')
sio = socketio.AsyncServer(client_ma…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ivanthewebber
Comment options

@ovftank

This comment was marked as off-topic.

Answer selected by ivanthewebber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
3 participants