Skip to content

Add WebSocket transport to client#388

Merged
l5yth merged 3 commits intomainfrom
l5y-add-ws/wss-support-to-eth-client
Oct 31, 2025
Merged

Add WebSocket transport to client#388
l5yth merged 3 commits intomainfrom
l5y-add-ws/wss-support-to-eth-client

Conversation

@l5yth
Copy link
Collaborator

@l5yth l5yth commented Oct 31, 2025

Summary

@l5yth l5yth added the codex Codex is a durable, decentralised data storage protocol label Oct 31, 2025 — with ChatGPT Codex Connector
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +110 to +114
context = OpenSSL::SSL::SSLContext.new
ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp, context)
ssl_socket.hostname = @host
ssl_socket.sync_close = true
ssl_socket.connect

Choose a reason for hiding this comment

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

P1 Badge Verify TLS certificates for wss connections

When a wss endpoint is used the socket is wrapped in OpenSSL::SSL::SSLSocket without configuring any verification on the SSLContext. By default verify_mode is VERIFY_NONE, so the client happily accepts any certificate and is vulnerable to man‑in‑the‑middle attacks. The context should load the system trust store and set verify_mode: OpenSSL::SSL::VERIFY_PEER before connect to ensure the server certificate is validated.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@codex fix comments

Choose a reason for hiding this comment

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

Summary

Testing

  • ⚠️ bundle exec rspec spec/eth/client/websocket_spec.rb (failed: bundler reported command not found: rspec)

View task →

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 85.91065% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.09%. Comparing base (1fa2465) to head (c0f5b8b).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/eth/client/websocket.rb 80.51% 30 Missing ⚠️
spec/eth/client/websocket_spec.rb 91.79% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #388      +/-   ##
==========================================
- Coverage   99.71%   99.09%   -0.62%     
==========================================
  Files          89       91       +2     
  Lines        6316     6659     +343     
==========================================
+ Hits         6298     6599     +301     
- Misses         18       60      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@l5yth l5yth merged commit d62a7e5 into main Oct 31, 2025
7 of 8 checks passed
@l5yth l5yth deleted the l5y-add-ws/wss-support-to-eth-client branch October 31, 2025 17:02
ShiningRay added a commit to ShiningRay/eth.rb that referenced this pull request Dec 24, 2025
* commit 'ab969176faf033eb0a6387b875ee3aa677c4bacf':
  build(deps): bump JamesIves/github-pages-deploy-action (q9f#395)
  build(deps): bump actions/checkout from 5 to 6 (q9f#394)
  add JSONRPC error code to Client::RpcError (q9f#392)
  Update README.md (q9f#393)
  build(deps): bump github/codeql-action from 3 to 4 (q9f#390)
  client/ws: fix client origin headers for ws requests (q9f#391)
  Rename websocket client to Ws and expand websocket tests (q9f#389)
  Add WebSocket transport to client (q9f#388)
  Support tuple arrays in ABI coder (q9f#387)
  Format EIP-4844 transaction constant (q9f#386)
  Fix ABI tuple handling for ethers test cases (q9f#385)
  Increase blob throughput limits (q9f#363)
  feat: use httpx for http requests (q9f#377) (q9f#382)
  fix: transform hash keys to strings in encoder for component type compatibility (q9f#378)
  fix: improve error handling for missing keys in component encoding (q9f#376)
  build(deps): bump actions/checkout from 4 to 5 (q9f#379)

# Conflicts:
#	eth.gemspec
#	lib/eth/client/http.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex Codex is a durable, decentralised data storage protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eth/client: add ws/wss support

1 participant