nxt-aws-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -12,2 +12,4 @@ "use strict"; | ||
this.options.logger.debug({ url: config.socket.url }, 'Connecting to WS server.'); | ||
this.requestsBus = new events_1.EventEmitter(); | ||
this.requestsBus.setMaxListeners(0); | ||
this.client = new WebSocket(config.socket.url, { | ||
@@ -21,4 +23,2 @@ headers: { | ||
this.client.on('unexpected-response', (req, res) => this.options.logger.debug({ code: res.statusCode, body: res.read(), status: res.statusMessage }, 'Unexpected socket response.')); | ||
this.requestsBus = new events_1.EventEmitter(); | ||
this.requestsBus.setMaxListeners(0); | ||
this.client.on('message', (data) => { | ||
@@ -54,3 +54,3 @@ const body = data.toString(); | ||
clearTimeout(timeoutId); | ||
this.requestsBus.off('event', handler); | ||
this.requestsBus.removeListener('event', handler); | ||
if (response.error) { | ||
@@ -63,3 +63,3 @@ reject(new Error(response.error)); | ||
timeoutId = setTimeout(() => { | ||
this.requestsBus.off('event', handler); | ||
this.requestsBus.removeListener('event', handler); | ||
reject(new Error('Request timeout.')); | ||
@@ -66,0 +66,0 @@ }, 5 * 1000); |
{ | ||
"name": "nxt-aws-client", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "./dist/index.js", | ||
@@ -23,3 +23,3 @@ "types": "./dist/index.d.ts", | ||
"@types/mime": "^2.0.1", | ||
"@types/node": "^12.12.37", | ||
"@types/node": "^8.10.60", | ||
"@types/ws": "^7.2.4", | ||
@@ -26,0 +26,0 @@ "dotenv-cli": "^3.1.0", |
21413