You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find it a bit surprising that a websocket request to Sanic ends up in an app.get handler (at least with the http1 server - didn't try asgi), as to my knowledge Sanic does not provide means to handle such requests in any meaningful way (you could respond 101 perhaps but then what?), and if you simply ignore the header, the connection will fail but your handler runs for nothing.
Also, it is not possible to serve GET and websocket (GET+Upgrade) at the same path like so:
Would it be possible to change the routing such that upgrade: websocket requests are considered a different method than GET, or alternatively make the scheme also a part of routing (ws, wss, http and https each being different routing-wise)?
On the front side the same path as the document is convenient:
// Same path (easy peasy)constws=newWebSocket(location.href.replace(/^http/,'ws'))// Different pathconstws_path='/ws'// sometimes hard to know in front codeconstws=newWebSocket(newURL(ws_path,location.href.replace(/^http/,'ws')))
The text was updated successfully, but these errors were encountered:
I find it a bit surprising that a websocket request to Sanic ends up in an
app.get
handler (at least with the http1 server - didn't try asgi), as to my knowledge Sanic does not provide means to handle such requests in any meaningful way (you could respond 101 perhaps but then what?), and if you simply ignore the header, the connection will fail but your handler runs for nothing.Also, it is not possible to serve GET and websocket (GET+Upgrade) at the same path like so:
Would it be possible to change the routing such that
upgrade: websocket
requests are considered a different method than GET, or alternatively make the scheme also a part of routing (ws, wss, http and https each being different routing-wise)?On the front side the same path as the document is convenient:
The text was updated successfully, but these errors were encountered: