yjs / y-websocket

Websocket Connector for Yjs
https://docs.yjs.dev/ecosystem/connection-provider/y-websocket
MIT License
492 stars 255 forks source link

Allow change config after creating provider #158

Open shincurry opened 10 months ago

shincurry commented 10 months ago

Authentication credentials (taking JWT as an example) can be placed in params.

If it is an accessToken, when the accessToken expires, we need to get a new accessToken by refresh Token, and use this new accessToken to reconnect to the Websocket server.

y-websocket use polling interval to try to reconnect when connection failed, so, allow to directly modify the config containing the token inside the WebsocketProvider instance, then the new token can be used to reconnect to server without re-creating the WebsocketProvider instance.

code changes: