it fails, since the WebSocket connection to the Communicator server has already been closed.
I’d like to check whether the connection is still active before calling loadSubtreeFromModel, and if it’s closed, automatically restart or reconnect the viewer session.
I tried checking this._viewer.webSocket or similar properties, but the IWebViewer interface doesn’t expose any connection status or readyState.
Is there any recommended or supported way to:
Detect if the viewer is still connected to the server before making server-dependent calls, and
Reconnect (or reinitialize) the viewer session automatically if the WebSocket is closed?
For reference, I’m using the IWebViewer class, and the main call looks like this:
There is a separate callback for timeout. You can try setting a timeout callback to confirm that the Websocket connection is being lost due an actual timeout event or something else. Perhaps there is another setting in your configuration that closes the Websocket after 2 minutes.
The connection may be being proactively closed due to your firewall setting or your cloud solution configuration. You will have to check this in your environment.