pladaria / reconnecting-websocket

Reconnecting WebSocket. For Web, React Native, cli (Node.js)
MIT License
1.23k stars 199 forks source link

Change WebSocket connection URL during runtime #20

Closed bennycode closed 7 years ago

bennycode commented 7 years ago

Our backend at Wire requires an access token as part of the WebSocket connection URL.

The schema looks like this:

wss://prod-nginz-ssl.wire.com/await?access_token=Dp42wWHPiGukagf86Djx7JvVKed

The access token must be renewed at a certain interval which leads to problems when using ReconnectingWebsocket because it will still try to reconnect to the URL it has been initialized with (which could have an outdated access_token).

Is there a chance to change the connection URL at runtime? Telling from the type definitions it doesn't look like it's accessible. 😢

pladaria commented 7 years ago

fixed in #4