INNER CODE UNIT · Python

ws_send

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

async def ws_send(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()
    stream_key = cvar_tenant.get() + ":stream"
    latest_ids = {stream_key: '$'}
    ws_connected = True
    first_run = True
    while pool and ws_connected:
        try:
            if first_run:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…