prevent ws endpoint from running without valid token
This commit is contained in:
parent
101dec461e
commit
fc59b02255
@ -81,8 +81,6 @@ async def validate_ws_token(
|
||||
except HTTPException:
|
||||
pass
|
||||
|
||||
# No checks passed, deny the connection
|
||||
logger.debug("Denying websocket request.")
|
||||
# If it doesn't match, close the websocket connection
|
||||
await ws.close(code=status.WS_1008_POLICY_VIOLATION)
|
||||
|
||||
|
@ -97,6 +97,7 @@ async def message_endpoint(
|
||||
rpc: RPC = Depends(get_rpc),
|
||||
message_stream: MessageStream = Depends(get_message_stream)
|
||||
):
|
||||
if token:
|
||||
async with create_channel(websocket) as channel:
|
||||
await channel.run_channel_tasks(
|
||||
channel_reader(channel, rpc),
|
||||
|
Loading…
Reference in New Issue
Block a user