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

Add wsbackend client #50

Merged
merged 10 commits into from
Oct 24, 2023
Merged

Add wsbackend client #50

merged 10 commits into from
Oct 24, 2023

Conversation

nguyer
Copy link
Contributor

@nguyer nguyer commented Oct 3, 2023

This PR adds a JSONRPC WebSocket client.

  • Provides sync CallRPC functionality over an async WebSocket transport
    • Manages JSON/RPC request IDs for you
    • Provides automatic reconnect, and all the other quality of life benefits of the firefly-common WebSocket impl
  • Supports eth_subscribe/eth_unsubscribe with a higher level Subscription semantic
    • Automatically resubscribes if your WebSocket reconnects
    • Has a client-side ID to track your subscription, as well as the server-side ID (which changes on reconnect)
    • At-most-once delivery semantics is all you get with raw Ethereum WebSockets (it's all the eth_ protocol supports) - you miss it, you lose it
      • If you need more than that, use the full FireFly core which provides reliable check-pointed subscriptions with a higher level blockchain connector

Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2023

Codecov Report

Merging #50 (7e346ca) into main (be29668) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              main       #50    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           34        35     +1     
  Lines         2707      3015   +308     
==========================================
+ Hits          2707      3015   +308     
Files Coverage Δ
pkg/ethtypes/hexinteger.go 100.00% <100.00%> (ø)
pkg/rpcbackend/backend.go 100.00% <100.00%> (ø)
pkg/rpcbackend/wsbackend.go 100.00% <100.00%> (ø)

Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding my approval as code owner in this repo - but also asked @matthew1001 to take a look as @nguyer and I have now both made significant contributions

…cel RPC calls

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst peterbroadhurst merged commit e4d4a70 into main Oct 24, 2023
2 checks passed
@peterbroadhurst peterbroadhurst deleted the wsbackend branch October 24, 2023 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants