Unit
ScWebSocketClient
Description
TScWebSocketClient is a component that implements functionality of the WebSocket client and allows connecting to a WebSocket server without using third-party libraries or components.
TScWebSocketClient supports both non-secure communication mode and secure mode using TLS/SSL protocol. To set up a TLS connection, use the SSLOptions property.
The Connect method makes a request using HTTP protocol to the resource specified in the RequestUri property and if the server supports a WebSocket protocol, establishes a connection.
To send data to the server, use the Send method.
You can retrieve data both in a synchronous mode, using the Receive method for reading, and in an asynchronous mode, handling the OnMessage event.
The TScWebSocketClient class throws a WebSocketException exception when an error occurs during the session.
Also, the component supports the HeartBeat mode to keep a websocket connection alive and the WatchDog mode to reconnect to the server automatically when there is an unexpected disconnection.
See Also