openvidu-browser: close WebSocket with code and reason

pull/678/head
pabloFuente 2021-12-23 11:18:42 +01:00
parent c8597b450e
commit 18c7e5d524
1 changed files with 3 additions and 7 deletions

View File

@ -102,7 +102,7 @@ function WebSocketWithReconnection(config) {
function reconnectAux(maxRetries, numRetries) { function reconnectAux(maxRetries, numRetries) {
Logger.debug("Reconnection attempt #" + numRetries); Logger.debug("Reconnection attempt #" + numRetries);
ws.close(); ws.close(4104, 'Connection closed for reconnection');
ws = new WebSocket(wsUri); ws = new WebSocket(wsUri);
ws.onopen = () => { ws.onopen = () => {
@ -131,13 +131,9 @@ function WebSocketWithReconnection(config) {
}; };
} }
this.close = () => { this.close = (code, reason) => {
closing = true; closing = true;
ws.close(); ws.close(code, reason);
};
this.forceClose = () => {
ws.close();
}; };
this.reconnectWs = () => { this.reconnectWs = () => {