getWebsocketReadyState
[ Function ]
public static getWebsocketReadyState(): number | null;Returns the current value of the web socket state. Instead of the number you should compare with the constant of the web socket object.
![]() | Since version 1.14 this function is considered obsolete. The use of the function isReady is recommended. |
Parameters
Name | Type | Description |
|---|---|---|
- | - | - |
Return value
Type | Description |
|---|---|
State value of the websocket. |
![]() | Available from 1.8 |
Example – JavaScript
var readyState = TcHmi.Server.getWebsocketReadyState();
if(readyState === WebSocket.OPEN){
// Websocket is ready.
} else {
// Websocket is not ready.
}Example 2 - JavaScript
This example is identical to the example shown above
var readyState = TcHmi.Server.getWebsocketReadyState();
if(readyState === 1){
// Websocket is ready.
} else {
// Websocket is not ready.
}