-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set url parameters for reconnecting #251
Comments
Ough.. I think this is really odd behavior that doesn't really sound like proper API design. Have you tried using something like HTTP 301 status codes to do redirection to different endpoint? I am not sure if I like the idea of redesigning the public interface for this "edge-casey" use case. |
That doesn't seem to work with authentication. Also the javascript socket.io library supports this. |
Can you point me to the JS implementation of this? |
The official socket.io documentation has an example of updating the query parameters on reconnect1: socket.io.on("reconnect_attempt", () => {
socket.io.opts.query.x++;
}); I actually also only need the ability to change the query parameters, not the full url. Footnotes |
This seems to be a valid use case. I'm running into the same auth problem myself now. When a reconnect is required, I should be able to pass a new auth value. It seems like a callback for reconnect would solve this and a few other problems, like the app needing to know when a reconnect is about to happen. |
@rageshkrishna I think you should open a new issue, as this issue has been fixed. |
I need to connect a socket.io that on connection will check if a specific query parameter contains a valid JWT token (which is not expired).
During the lifetime of the client using this library, the JWT token will expire. I can retrieve a fresh token which is not expired, but I need to update the url that rust-socketio uses for reconnection, otherwise reconnection will fail.
I see two different approaches for implementing this:
set_reconnect_url
function toClient
.on_reconnect
function toClientBuilder
with the signaturefn(ClientBuilder) -> ClientBuilder
. Before the client tries to reconnect it will use the reconnect handler (if specified) to get a modifiedClientBuilder
. This handler can then change the url, opening headers, auth, etc...I have implemented option 1 in #252
The text was updated successfully, but these errors were encountered: