New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add id to all JSON RPC calls like in advanceBlock #56
Comments
Hello @cnasikas, thanks for reporting this! It that behavior present in v1.0-beta.37 of I'm curious, why are you running tests using a websocket provider? |
@cnasikas Do you know if this |
From https://www.jsonrpc.org/specification#request_object and https://github.com/ethereum/wiki/wiki/JSON-RPC
|
As far I understand the id is used as an identifier for a listener. For example in web3js beta.55:
|
Makes sense.
From Stack Overflow. |
Does the id need to be unique every time? I can't find any info on this. |
That's a good question. I was thinking myself the same. What will happen if you have two requests with the same id ? If the ID is only used as an event name when you register to a listener then if you register multiple callbacks (one for each requests) to the same event normally all will be fired, right ? |
I think it should be unique just in case but I am not sure if it is the correct approach. |
Metamask's id generator function: https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lib/random-id.js |
We can probably address this in a 0.4.1 bugfix release. @cnasikas have you by chance tried this fix locally, to check that it does solve your issue? Also, if you could provide a short snippet that triggers the bug, for us to add as a new test, that'd be great :) |
@nventuro Sorry for the late response. I tried to fix it locally as follows and it resolves my issue (the id should be change to something unique).
Snippet that triggers the bug:
|
Closed via #92 |
Hi
The
advanceBlock
function does not provide an id as a property. The web3-provider-ws package uses the id as follows:The line
var id = payload.id || payload[0].id;
will produce an error when an id isundefined
The same checks is presented in the new version of web3.
Thanks a lot!
The text was updated successfully, but these errors were encountered: