This commit is contained in:
yumoqing 2024-04-28 11:18:17 +08:00
parent 6b1aece29e
commit 226c3fbb37
2 changed files with 6 additions and 6 deletions

View File

@ -6,10 +6,10 @@
# 发送消息给客户端当id为空时发送给当前链接的客户端否则发送给id指定的客户端 # 发送消息给客户端当id为空时发送给当前链接的客户端否则发送给id指定的客户端
# is_online(id) # is_online(id)
# 检查id指定的客户端是否在线 # 检查id指定的客户端是否在线
# user = await get_user()
# ws_pool.register(user)
resp = 'resp=' + ws_data resp = 'resp=' + ws_data
user = await get_user() print(f'{resp=}')
ws_pool.register(user)
print(f'{resp=}, {user=}')
await ws_pool.sendto(resp) await ws_pool.sendto(resp)
if ws_pool.is_online('bington'): # if ws_pool.is_online('bington'):
await ws_pool.sendto(resp, 'bington') # await ws_pool.sendto(resp, 'bington')

View File

@ -3,6 +3,6 @@
"options":{ "options":{
"width":"100%", "width":"100%",
"height":"100%", "height":"100%",
"ws_url":"{{entire_url('echo.ws')}}" "ws_url":"ws://localhost/bricks/examples/echo.ws"
} }
} }