pladaria / reconnecting-websocket

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

Support for Dynamic Protocols #163

Open maxfortun opened 3 years ago

maxfortun commented 3 years ago

Issue [#162].

Feature: Dynamically provide Protocols on reconnect.

Use case: Protocols is the only mechanism available to WebSocket to pass initialization information to the backend at connection time. As such, this could be leveraged for authorization. Modern authorization mechanisms, such as tokens, rotate over time and reconnecting with an old token will eventually fail. A dynamic Protocols provider can produce valid tokens at reconnect time.