INNER CODE UNIT · Python

add_room_user

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

async def add_room_user(chat_info: dict, pool):
    #added = await pool.sadd(chat_info['room']+":users", chat_info['username'])
    added = await pool.sadd(cvar_tenant.get()+":users", cvar_chat_info.get()['username'])
    return added


async def remove_room_user(chat_info: dict, pool):
    #removed = await pool.srem(chat_info['room']+":users", chat_info['username'])
    removed = await pool.srem(cvar_tenant.get()+":users", cvar_chat_info.get()['username'])
    return removed


async def room_users(chat_info: dict, pool):
    #users = await pool.smembers(chat_info['room']+":users")
    users = await pool.smembers(cvar_tenant.get()+":users")
    print(len(users))
    return users

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…