bugfix
This commit is contained in:
parent
cf5cd792dc
commit
7eacc6e625
@ -102,10 +102,10 @@ class WsPool:
|
|||||||
|
|
||||||
def is_online(self, userid):
|
def is_online(self, userid):
|
||||||
data = self.get_data()
|
data = self.get_data()
|
||||||
if data.get(userid):
|
ws = data.get(userid)
|
||||||
return True
|
if ws is None:
|
||||||
else:
|
|
||||||
return False
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def register(self, id):
|
def register(self, id):
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -143,25 +143,17 @@ class WebsocketProcessor(PythonScriptProcessor):
|
|||||||
lenv.update(params)
|
lenv.update(params)
|
||||||
params_kw = lenv.params_kw
|
params_kw = lenv.params_kw
|
||||||
userid = lenv.params_kw.userid or await lenv.get_user()
|
userid = lenv.params_kw.userid or await lenv.get_user()
|
||||||
print(f'{params_kw=}, {userid=} ============')
|
|
||||||
print(f'{request.path=}1')
|
|
||||||
del lenv['request']
|
del lenv['request']
|
||||||
print(f'{request.path=}1.1')
|
|
||||||
txt = await self.loadScript(self.real_path)
|
txt = await self.loadScript(self.real_path)
|
||||||
print(f'{request.path=}2')
|
|
||||||
ws = web.WebSocketResponse()
|
ws = web.WebSocketResponse()
|
||||||
print(f'{request.path=}3', ws.closed)
|
|
||||||
try:
|
try:
|
||||||
await ws.prepare(request)
|
await ws.prepare(request)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('--------except:', e, type(e))
|
print('--------except:', e, type(e))
|
||||||
print_exc()
|
print_exc()
|
||||||
raise e
|
raise e
|
||||||
print(f'{request.path=}4')
|
|
||||||
ws_pool = WsPool(ws, request.path, request.app)
|
ws_pool = WsPool(ws, request.path, request.app)
|
||||||
print(f'{request.path=}5')
|
|
||||||
async for msg in ws:
|
async for msg in ws:
|
||||||
print(f'{msg=}')
|
|
||||||
if msg.type == aiohttp.WSMsgType.TEXT:
|
if msg.type == aiohttp.WSMsgType.TEXT:
|
||||||
if msg.data == 'exit':
|
if msg.data == 'exit':
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user