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:
Save serverUrl as a public property
Save params as a public property
Make url property as a readonly computed property
Make bcChannel property as a readonly computed property
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:
serverUrl
as a public propertyparams
as a public propertyurl
property as a readonly computed propertybcChannel
property as a readonly computed property