openvidu-browser: clean "closeSession" configuration from jsonrpcclient.js

pull/546/head
pabloFuente 2020-09-17 16:50:41 +02:00
parent 834da536b6
commit 693e2e6583
2 changed files with 1 additions and 15 deletions

View File

@ -759,7 +759,6 @@ export class OpenVidu {
startWs(onConnectSucces: (error: Error) => void): void { startWs(onConnectSucces: (error: Error) => void): void {
const config = { const config = {
heartbeat: 5000, heartbeat: 5000,
sendCloseMessage: false,
ws: { ws: {
uri: this.wsUri, uri: this.wsUri,
onconnected: onConnectSucces, onconnected: onConnectSucces,

View File

@ -33,7 +33,6 @@ var Logger = console;
/** /**
* *
* heartbeat: interval in ms for each heartbeat message, * heartbeat: interval in ms for each heartbeat message,
* sendCloseMessage : true / false, before closing the connection, it sends a closeSession message
* <pre> * <pre>
* ws : { * ws : {
* uri : URI to conntect to, * uri : URI to conntect to,
@ -250,25 +249,13 @@ function JsonRpcClient(configuration) {
this.close = function (code, reason) { this.close = function (code, reason) {
Logger.debug("Closing with code: " + code + " because: " + reason); Logger.debug("Closing with code: " + code + " because: " + reason);
if (pingInterval != undefined) { if (pingInterval != undefined) {
Logger.debug("Clearing ping interval"); Logger.debug("Clearing ping interval");
clearInterval(pingInterval); clearInterval(pingInterval);
} }
pingPongStarted = false; pingPongStarted = false;
enabledPings = false; enabledPings = false;
if (configuration.sendCloseMessage) {
Logger.debug("Sending close message")
this.send('closeSession', null, function (error, result) {
if (error) {
Logger.error("Error sending close message: " + JSON.stringify(error));
}
ws.close(code, reason); ws.close(code, reason);
});
} else {
ws.close(code, reason);
}
} }
// This method is only for testing // This method is only for testing