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
The traditional way to include additional parameters with a Socket.IO connection is with the query option, something like
constsocket=io({query: {token: "abc"}});
This attaches the items as query parameters on the connection URL, so they can be read with flask_socketio by looking at request.args.
However, query parameters can cause unexpected behavior with multiplexed connections (because the connection is recycled, the connection URL, and thus the query parameters, aren't updated). To address this, Socket.io 3.x added an auth option for the connection function:
constsocket=io({auth: {token: "abc"}});
Per the Socket.IO docs, auth values are sent in the CONNECT packet as opposed to the query parameters.
Is there a way to read these auth values with flask_socketio? My apologies if this is documented somewhere, but I haven't been able to find it. Thank you!
This change was implemented in the python-socketio package, which receives the auth argument in the connect handler function. But this change has not been implemented in Flask-SocketIO yet. I'll keep this issue open as a reminder to add it.
The traditional way to include additional parameters with a Socket.IO connection is with the
query
option, something likeThis attaches the items as query parameters on the connection URL, so they can be read with flask_socketio by looking at
request.args
.However, query parameters can cause unexpected behavior with multiplexed connections (because the connection is recycled, the connection URL, and thus the query parameters, aren't updated). To address this, Socket.io 3.x added an
auth
option for the connection function:Per the Socket.IO docs,
auth
values are sent in theCONNECT
packet as opposed to the query parameters.Is there a way to read these
auth
values with flask_socketio? My apologies if this is documented somewhere, but I haven't been able to find it. Thank you!Socket.IO notes on the
auth
parameterThe text was updated successfully, but these errors were encountered: