In version X18, we introduced a new feature that reconnects the WebSocket connection automatically in case it got disconnected. This happens in exceptional cases, but it is possible. For example, if the Internet connection randomly goes off for a short period of time.
In order to use one of the client-side TX Text Control document editors including MVC, Web Forms, Angular and Node.js, the following components are required:
- A client-side library
- Server-side WebSocketHandler (Node.js or ASP.NET on Linux or Windows)
- Document synchronization TCP service (Windows)
The client-side component opens a constant WebSocket connection to the WebSocketHandler running within the WebSocketServer. When the connection is lost, TX Text Control is trying to reconnect to the same instance for a specific period of time.
If the connection is successfully re-established, unsaved changes are not lost and the complete document state is still available.
The following screen video shows this reconnection process. To simulate an interruption, the hosting Web Application is stopped. As soon as the application is restarted, the connection is established and the document is at the same state like before the disconnection.
The default time the editor is trying to reconnect is 30 seconds. After that, the connection is lost and the service instance is closed. This ReconnectTime can be adjusted in seconds in the settings as shown here for the MVC Html Helper:
In case, the connection is lost, the webSocketClosed event is fired and informs about the reason. This event can be used to trigger an action like an UI update to inform users about the disconnection.