Skip to content

feat: Add WebSockets support#3450

Merged
FrederikBolding merged 31 commits intomainfrom
fb/websockets
Jun 13, 2025
Merged

feat: Add WebSockets support#3450
FrederikBolding merged 31 commits intomainfrom
fb/websockets

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Jun 11, 2025

Implements the rewritten SIP-20 to enable WebSocket support in Snaps.

WebSockets are supported via the WebSocketService which runs in the client and handles open WebSocket connections for the Snap. The Snap is notified of WebSocket events via onWebSocketEvent and is notified of open, close and message. Messages can also be sent from the Snap using snap_sendWebSocketMessage. Both string and binary payloads are allowed.

All of the new RPC methods are gated on endowment:network-access, which is also the permission required to expose onWebSocketEvent.

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.21%. Comparing base (08bb538) to head (c0a0661).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3450      +/-   ##
==========================================
+ Coverage   98.18%   98.21%   +0.02%     
==========================================
  Files         399      404       +5     
  Lines       11136    11314     +178     
  Branches     1746     1763      +17     
==========================================
+ Hits        10934    11112     +178     
  Misses        202      202              

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@FrederikBolding FrederikBolding changed the title wip: Add WebSockets support feat: Add WebSockets support Jun 12, 2025
@FrederikBolding FrederikBolding requested a review from Mrtenz June 12, 2025 12:08
@FrederikBolding FrederikBolding marked this pull request as ready for review June 13, 2025 08:15
@FrederikBolding FrederikBolding requested a review from a team as a code owner June 13, 2025 08:15
url: string;
openPromise: Promise<void>;
// eslint-disable-next-line no-restricted-globals
socket: WebSocket;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that this doesn't work on Node.js. Probably fine though.

@FrederikBolding FrederikBolding requested a review from Mrtenz June 13, 2025 13:05
@FrederikBolding FrederikBolding added this pull request to the merge queue Jun 13, 2025
Merged via the queue into main with commit 1f4fc7a Jun 13, 2025
117 checks passed
@FrederikBolding FrederikBolding deleted the fb/websockets branch June 13, 2025 14:14
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.

2 participants