0.1.9 fix initTimeout and retryWait option setting for when zero
parent
a21aa3bf88
commit
3fb6d99dcc
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@uci/websocket-client",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"description": "JSON packet browser client over web socket",
|
||||
"main": "src",
|
||||
"watch": {
|
||||
|
@ -34,10 +34,10 @@
|
|||
"npm-watch": "^0.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"auto-bind": "^2.1.0",
|
||||
"auto-bind": "^4.0.0",
|
||||
"better-try-catch": "^0.6.2",
|
||||
"delay": "^4.3.0",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"ws": "^7.1.2"
|
||||
"ws": "^7.2.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ class WSConsumer extends EventEmitter {
|
|||
this.name = opts.name || 'browser'
|
||||
this.instanceID = new Date().getTime()
|
||||
this.url = url
|
||||
this.initTimeout = opts.initTimeout * 1000 || 60000
|
||||
this.retryWait = opts.retryWait * 1000 || 5000
|
||||
this.initTimeout = opts.initTimeout!=null ? opts.initTimeout * 1000 : 60000
|
||||
this.retryWait = opts.retryWait!=null ? opts.retryWait * 1000 : 5000
|
||||
this.protocol = opts.protocol // available if needed but not documented
|
||||
this.opts = opts
|
||||
this._connected = false
|
||||
|
@ -38,6 +38,9 @@ class WSConsumer extends EventEmitter {
|
|||
autoBind(this)
|
||||
}
|
||||
|
||||
// TODO refactor like for tcp socket
|
||||
// emit connection events
|
||||
|
||||
/**
|
||||
* connect - After instantiating this must be called to connect to a UCI WesbSocket Sever
|
||||
* @required
|
||||
|
@ -52,8 +55,8 @@ class WSConsumer extends EventEmitter {
|
|||
this._conAttempt = 1
|
||||
this.url = opts.url || this.url
|
||||
this.name = opts.name || this.name
|
||||
this.initTimeout = opts.initTimeout || this.initTimeout
|
||||
this.retryWait = opts.retryWait || this.retryWait
|
||||
this.initTimeout = opts.initTimeout!=null ? opts.initTimeout * 1000 : this.initTimeout
|
||||
this.retryWait = opts.retryWait!=null ? opts.retryWait * 1000 : this.retryWait
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
|
|
Loading…
Reference in New Issue