mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 23:49:44 +08:00
Fix json-rpc-over-ws example
This commit is contained in:
parent
9c60a1bc10
commit
52e66077a7
@ -23,12 +23,12 @@ var jsonrpc = function(url, onopen, onclose, onnotification) {
|
|||||||
ws.send(JSON.stringify(request));
|
ws.send(JSON.stringify(request));
|
||||||
console.log('sent', request);
|
console.log('sent', request);
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
setTimeout(JSONRPC_TIMEOUT_MS, function() {
|
setTimeout(function() {
|
||||||
if (pending[id] === undefined) return;
|
if (pending[id] === undefined) return;
|
||||||
log('Timing out frame ', JSON.stringify(request));
|
log('Timing out frame ', JSON.stringify(request));
|
||||||
delete (pending[id]);
|
delete (pending[id]);
|
||||||
reject();
|
reject();
|
||||||
});
|
}, JSONRPC_TIMEOUT_MS);
|
||||||
pending[id] = x => resolve(x);
|
pending[id] = x => resolve(x);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user