TsgcWebSocketClient › Properties › HeartBeat
Sends periodic WebSocket ping frames to keep the connection alive.
public TsgcWSHeartBeat_Options HeartBeat { get; set; }
Enabled=False
When HeartBeat.Enabled is True, the client sends a ping every Interval seconds. Sub-properties include Timeout (maximum seconds between ping and pong before the connection is closed, 0 to disable) and HeartBeatType: hbtAlways sends a ping on every interval, while hbtOnlyIfNoMsgRcvInterval only pings when no message has been received during the last interval. The OnBeforeHeartBeat event lets you replace the default ping with a custom message.
oClient = new TsgcWebSocketClient();
oClient.HeartBeat.Interval = 30;
oClient.HeartBeat.Timeout = 0;
oClient.HeartBeat.Enabled = true;
oClient.Active = true;