Skip to content
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

Update websocket jsonrpc subscribe request parsing and response building #20

Closed

Conversation

hussein-aitlahcen
Copy link

@hussein-aitlahcen hussein-aitlahcen commented Aug 3, 2021

This PR fixes the websocket jsonrpc subscription endpoint.
I found that the implementation was different than almost everything I have checked online (is there any RFC for the subscription part? I only found this).

The jsonrpc subscribe endpoints should return the subscription ID straight in the result field. Whereas in pyth-client we wrap the id in a an object with a subscription field containing the ID.
Also, the parameter provided should be either an array or a null value, but we ask for an object containing the account field we are interested in.

Because of that, the usage of the rust jsonrpc library was impossible. I messed for hours until realising :P. All the online documentations about jsonrpc are all stating that the id should be straight in the result and that the arguments should be wrapped in an array. See:

With this patch, we are able to use the rust jsonrpc library without trouble. Please let me know whether I missed something or if my fix is wrong (I also fixed the absolute path used in the init script to make it more portable, as a NixOS user, it was impossible for me to run it).

@mass mass added the enhancement New feature or request label Aug 12, 2021
@mass mass linked an issue Aug 12, 2021 that may be closed by this pull request
@mass
Copy link
Contributor

mass commented Aug 12, 2021

As I mentioned on #27, this looks good but we will wait a while to merge. Thanks for the PR!

@jayantk jayantk closed this Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arbitrary JSON RPC subscription API?
3 participants