Bugfix/http redirect to ws (#211)

* allow redirect to ws(s) url after starting with http(s) #210

* further fixes for #210
This commit is contained in:
Dave Horton
2023-01-07 15:00:18 -05:00
committed by GitHub
parent 2e3fb60e72
commit 0c52324915
3 changed files with 27 additions and 6 deletions

View File

@@ -82,12 +82,18 @@ class CallSession extends Emitter {
this._pool = srf.locals.dbHelpers.pool;
const handover = (newRequestor) => {
this.logger.info(`handover to new base url ${newRequestor.url}`);
this.requestor.removeAllListeners();
this.application.requestor = newRequestor;
this.requestor.on('command', this._onCommand.bind(this));
this.requestor.on('connection-dropped', this._onWsConnectionDropped.bind(this));
this.requestor.on('handover', handover.bind(this));
};
this.requestor.on('command', this._onCommand.bind(this));
this.requestor.on('connection-dropped', this._onWsConnectionDropped.bind(this));
this.requestor.on('handover', (newRequestor) => {
this.logger.info(`handover to new base url ${newRequestor.url}`);
this.application.requestor = newRequestor;
});
this.requestor.on('handover', handover.bind(this));
}
/**