Add unique ID to JSON-RPC requests
This commit is contained in:
parent
1567a2de0a
commit
cba3ec3091
1 changed files with 5 additions and 1 deletions
|
@ -57,13 +57,17 @@ jsonrpc.call = function (connectionString, method, params, callback, errorCallba
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const counter = parseInt(sessionStorage.getItem('JSONRPCCounter') || 0);
|
||||||
|
|
||||||
xhr.open('POST', connectionString, true);
|
xhr.open('POST', connectionString, true);
|
||||||
xhr.send(JSON.stringify({
|
xhr.send(JSON.stringify({
|
||||||
'jsonrpc': '2.0',
|
'jsonrpc': '2.0',
|
||||||
'method': method,
|
'method': method,
|
||||||
'params': params,
|
'params': params,
|
||||||
'id': 0
|
'id': counter,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
sessionStorage.setItem('JSONRPCCounter', counter + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default jsonrpc;
|
export default jsonrpc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue