Skip to content

feat(social-controllers): add realtime feed service - #10561

Merged
xavier-brochard merged 4 commits into
mainfrom
feat/social-realtime-service
Sep 29, 2026
Merged

xavier-brochard merged 4 commits into
mainfrom
feat/social-realtime-service

Conversation

@xavier-brochard

@xavier-brochard xavier-brochard commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add SocialRealtimeService for subscribing to Social realtime feed events through the shared backend WebSocket connection.
  • Align the @metamask/core-backend dependency with the v11 workspace package.
  • Serialize connection and subscription setup to prevent duplicate subscriptions during synchronous CONNECTED notifications.
  • Retry subscription setup when an overlapping activation or cleanup completes without a live subscription.
  • Keep subscription ownership local to SocialRealtimeService so existing backend subscriptions are not adopted or unsubscribed accidentally.
  • Export the service and event types from @metamask/social-controllers.

Testing

  • yarn workspace @metamask/social-controllers run test --no-coverage
  • yarn workspace @metamask/social-controllers run build
  • yarn workspace @metamask/social-controllers run changelog:validate
  • yarn workspace @metamask/social-controllers run lint:tsconfigs
  • yarn lint:misc --check packages/social-controllers/src/SocialRealtimeService.ts packages/social-controllers/src/SocialRealtimeService.test.ts
  • yarn lint:oxlint packages/social-controllers/src/SocialRealtimeService.ts packages/social-controllers/src/SocialRealtimeService.test.ts packages/social-controllers/src/index.ts packages/social-controllers/src/index.test.ts

Note

Medium Risk
New WebSocket subscription lifecycle and async edge cases (reconnect, race on deactivate) could affect feed freshness if mis-integrated, but failures are best-effort and scoped to Social realtime.

Overview
Adds SocialRealtimeService to @metamask/social-controllers so clients can receive live Social feed updates over the existing BackendWebSocketService connection (channel social.v1.feed.all), without opening a separate socket.

Consumers call setActive(true|false) to subscribe/unsubscribe (e.g. when the feed tab is focused), optionally gated by isEnabled. Valid feed-item payloads are validated and forwarded to listeners; reconnects trigger resubscription and optional addReconnectListener callbacks. Subscription setup is serialized to avoid duplicates during rapid connect/disconnect and overlapping activate/deactivate.

The package now depends on @metamask/core-backend ^11.0.0, exports the service and related types from the public index, and documents the dependency in the monorepo graph. This is a new exported capability—SocialController is not wired to it in this PR.

Reviewed by Cursor Bugbot for commit e388abc. Bugbot is set up for automated code reviews on this repo. Configure here.

@xavier-brochard
xavier-brochard requested review from a team as code owners September 29, 2026 08:13
Co-authored-by: Cursor <cursoragent@cursor.com>
@xavier-brochard
xavier-brochard force-pushed the feat/social-realtime-service branch from 927c9da to 0c253fe Compare September 29, 2026 08:14
Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2f8a7e4. Configure here.

Comment thread packages/social-controllers/src/SocialRealtimeService.ts
xavier-brochard and others added 2 commits September 29, 2026 10:55
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@xavier-brochard
xavier-brochard added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 6e814a7 Sep 29, 2026
44 checks passed
@xavier-brochard
xavier-brochard deleted the feat/social-realtime-service branch September 29, 2026 11:43
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