-
-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
Description
I've been trying to implement ConnectionRefused exception messaging to signal to my clients why their connections are refused.
However, my clients use the socket.io library with the websocket transport only (polling transport disabled). And it seems that that triggers the following codepath:
async def make_response(status, headers, payload, environ):
headers = [(h[0].encode('utf-8'), h[1].encode('utf-8')) for h in headers]
if environ['asgi.scope']['type'] == 'websocket':
if status.startswith('200 '):
await environ['asgi.send']({'type': 'websocket.accept',
'headers': headers})
else:
await environ['asgi.send']({'type': 'websocket.close'}) # <---- codepath ends here
return
await environ['asgi.send']({'type': 'http.response.start',
'status': int(status.split(' ')[0]),
'headers': headers})
await environ['asgi.send']({'type': 'http.response.body',
'body': payload}) # <---- this contains my connection refused messageAnd the payload is never returned to the client.
Does this mean that it only works with the socket.io polling transport?
SeeDoubleYou