🎉 svc-infra v1.0 is here — Production-ready backend infrastructure
What's new
nfrax logonfrax

Infrastructure that just works. Ship products, not boilerplate.

Frameworks

  • svc-infra
  • ai-infra
  • fin-infra
  • robo-infra

Resources

  • Getting Started
  • What's New
  • Contributing

Community

  • GitHub

© 2026 nfrax. All rights reserved.

nfrax logonfrax
Start HereWhat's New
GitHub
svc-infra / API Reference

ConnectionManager

from svc_infra.websocket.manager import ConnectionManager
svc_infra.websocket.manager

Server-side WebSocket connection manager. Features: - Track multiple connections per user - Room/group support for targeted broadcasts - Connection lifecycle hooks - Thread-safe with asyncio.Lock

Example

manager = ConnectionManager() @app.websocket("/ws/{user_id}") async def websocket_endpoint(websocket: WebSocket, user_id: str): await manager.connect(user_id, websocket) try: async for message in websocket.iter_json(): await manager.broadcast(message) finally: await manager.disconnect(user_id, websocket)

Methods

On This Page

Constructorbroadcastbroadcast_to_roomconnectdisconnectget_room_usersget_user_connectionsis_user_connectedjoin_roomleave_roomon_connecton_disconnectsend_to_user