Added a method to check if the socket is connected to the server or not

This commit is contained in:
Pierre HUBERT 2019-01-25 14:50:23 +01:00
parent 7318468d49
commit aae5326bf9
2 changed files with 18 additions and 0 deletions

View File

@ -119,6 +119,15 @@ class SignalExchangerClient {
});
}
/**
* Use this method to get the current connection status to the server
*
* @return {Boolean} TRUE if the client is connected to the server / FALSE else
*/
isConnected() {
return this.socket.readyState == WebSocket.OPEN;
}
/**
* Method called once the client is successfully
* connected to the client

View File

@ -119,6 +119,15 @@ class SignalExchangerClient {
});
}
/**
* Use this method to get the current connection status to the server
*
* @return {Boolean} TRUE if the client is connected to the server / FALSE else
*/
isConnected() {
return this.socket.readyState == WebSocket.OPEN;
}
/**
* Method called once the client is successfully
* connected to the client