book_server_api.routers.discuss module¶
- class book_server_api.routers.discuss.ConnectionManager¶
Bases:
object
- async broadcast(message: str) None ¶
- async connect(user: str, websocket: WebSocket)¶
- disconnect(sockid: str)¶
- async send_personal_message(receiver: str, message: Dict[str, Any])¶
- async book_server_api.routers.discuss.get_cookie_or_token(websocket: WebSocket, access_token: Optional[str] = Cookie(None), user: Optional[str] = Query(None))¶
- async book_server_api.routers.discuss.send_message(packet: PeerMessage)¶
- async book_server_api.routers.discuss.websocket_endpoint(websocket: WebSocket, uname: str)¶
This endpoint is called to establish a websocket connection between The browser and the server. The websocket is persistent as long as the process that runs this endpoint is alive.
Note: This function must return which means it must be throroughly async Using a non async library like plain redis-py will not work as the subscriber will block