mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
feat/1034: sending socket close code when there is no response from the websocket app (#1035)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const assert = require('assert');
|
||||
const BaseRequestor = require('./base-requestor');
|
||||
const short = require('short-uuid');
|
||||
const {HookMsgTypes} = require('./constants.json');
|
||||
const {HookMsgTypes, WS_CLOSE_CODES} = require('./constants.json');
|
||||
const Websocket = require('ws');
|
||||
const snakeCaseKeys = require('./snakecase-keys');
|
||||
const {
|
||||
@@ -261,13 +261,13 @@ class WsRequestor extends BaseRequestor {
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
close(code = WS_CLOSE_CODES.NormalClosure) {
|
||||
this.closedGracefully = true;
|
||||
this.logger.debug('WsRequestor:close closing socket');
|
||||
this.logger.debug(`WsRequestor:close closing socket with code ${code}`);
|
||||
this._stopPingTimer();
|
||||
try {
|
||||
if (this.ws) {
|
||||
this.ws.close(1000);
|
||||
this.ws.close(code);
|
||||
this.ws.removeAllListeners();
|
||||
this.ws = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user