Add unique ID to JSON-RPC requests

This commit is contained in:
Alex Liebowitz 2017-03-08 04:28:00 -05:00
parent 1567a2de0a
commit cba3ec3091

View file

@ -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;