bugfix: check websocket before send requests
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
8b8f3cf939
commit
25a7e8a33b
1 file changed
+9
-7
@@ -86,12 +86,14 @@ export default class WebSocketClient {
|
||||
}
|
||||
|
||||
sendObj (method, params, action = '') {
|
||||
let id = Math.floor(Math.random() * 10000) + 1
|
||||
this.wsData.push({
|
||||
id: id,
|
||||
action: action,
|
||||
params: params
|
||||
})
|
||||
this.instance.send(this.createMessage(method, params, id))
|
||||
if (this.instance.readyState === WebSocket.OPEN) {
|
||||
let id = Math.floor(Math.random() * 10000) + 1
|
||||
this.wsData.push({
|
||||
id: id,
|
||||
action: action,
|
||||
params: params
|
||||
})
|
||||
this.instance.send(this.createMessage(method, params, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user