INNER CODE UNIT · Python
ws_recieve
leonh/redis-streams-fastapi-chat · chat.py:205
async def ws_recieve(websocket: WebSocket, chat_info: dict):
"""
receive json data from client over a WebSocket, add messages onto the
associated chat stream
:param websocket:
:type websocket:
:param chat_info:
:type chat_info:
"""
ws_connected = False
pool = await get_redis_pool()
added = await add_room_user(chat_info, pool)
if added:
await announce(pool, chat_info, 'connected')
ws_connected = True