INNER CODE UNIT · Python

ws_send_moderator

leonh/redis-streams-fastapi-chat · chat.py:118

async def ws_send_moderator(websocket: WebSocket, chat_info: dict):
    """
    wait for new items on chat stream and
    send data from server to client over a WebSocket

    :param websocket:
    :type websocket:
    :param chat_info:
    :type chat_info:
    """
    pool = await get_redis_pool()
    streams = chat_info['room'].split(',')
    latest_ids = {stream: '$' for stream in streams}
    ws_connected = True
    print(streams, latest_ids)
    while pool and ws_connected:
        try:
            events = await pool.xread(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…