Skip to content

Set url parameters for reconnecting #251

@tyilo

Description

@tyilo

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:

  1. Add a public set_reconnect_url function to Client.
  2. Add a on_reconnect function to ClientBuilder with the signature fn(ClientBuilder) -> ClientBuilder. Before the client tries to reconnect it will use the reconnect handler (if specified) to get a modified ClientBuilder. This handler can then change the url, opening headers, auth, etc...

I have implemented option 1 in #252

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions