Skip to content

feat(mobile): websocket streaming with real-time messaging - #323

Merged
wesbillman merged 2 commits into
mainfrom
feat/mobile-websocket-streaming
Apr 15, 2026
Merged

feat(mobile): websocket streaming with real-time messaging#323
wesbillman merged 2 commits into
mainfrom
feat/mobile-websocket-streaming

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Summary

  • Add robust websocket infrastructure to the mobile app mirroring the desktop's Nostr NIP-01/NIP-42 architecture — RelaySocket (connection + auth), RelaySession (subscriptions, 16ms event batching, exponential backoff reconnect with replay), AppLifecycle provider (background/foreground management)
  • Build channel detail page with real-time message list (history + live via websocket), typing indicators, compose bar with @mention resolution, user avatars and display names via batched profile lookups
  • Include nsec in desktop pairing payload so mobile can sign NIP-42 AUTH events and message events; migrate channels from 30s polling to hybrid HTTP + live websocket updates

Test plan

  • Pair mobile with desktop via new QR code (must include nsec)
  • Open a channel — verify messages load and new messages appear in real-time
  • Send a message from mobile — verify it appears on desktop
  • Send a message from desktop — verify it appears on mobile in real-time
  • @mention a bot (e.g. @rick hello) — verify bot responds
  • Background the app for >30s, return — verify reconnect and missed messages appear
  • Toggle airplane mode — verify exponential backoff reconnect
  • Pull-to-refresh on channel list — verify it works
  • Sign out and re-pair — verify clean flow
  • Run flutter analyze — 0 issues
  • Run flutter test — all 33 tests pass

🤖 Generated with Claude Code

wesbillman and others added 2 commits April 14, 2026 20:04
Add robust websocket infrastructure to the mobile app, mirroring the
desktop's Nostr NIP-01/NIP-42 architecture. This enables real-time
messaging, typing indicators, and presence — the foundation for all
future mobile features.

Core infrastructure:
- RelaySocket: low-level websocket + NIP-42 AUTH handshake with
  challenge/response signing and auth_token support
- RelaySession: subscription manager with history fetch (REQ/EOSE),
  live subscriptions, 16ms event batching, exponential backoff
  reconnect (1s→30s), and replay with since:lastSeen-5s
- AppLifecycleProvider: disconnect on background (30s grace),
  reconnect on foreground/network restore via connectivity_plus
- NostrEvent/NostrFilter models and EventKind constants

Feature providers:
- ChannelMessagesProvider: per-channel message list with history +
  live updates, pagination via fetchOlder()
- ChannelTypingProvider: per-channel typing indicators (8s TTL)
- SendMessageProvider: signs events with user's nsec, POSTs to relay
- UserCacheProvider: batched profile lookups for names/avatars
- ChannelsProvider migrated from 30s polling to hybrid HTTP + live

Channel detail page:
- Message list with avatars, display names, timestamps
- Typing indicator bar
- Compose bar with send button

Pairing changes (desktop + mobile):
- Desktop includes nsec in pairing payload for NIP-42 signing
- Mobile stores nsec in FlutterSecureStorage
- Removed debug-mode auth bypass (pairing flow is now required)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… preloading

- Filter message list to display events only (kind 9/40002) before
  computing author grouping — fixes non-message events (reactions,
  system) breaking the showAuthor logic
- Preload channel member profiles on channel open via /api/channels/{id}/members
  so @mentions resolve reliably for bots and other users
- Read user cache at send time (not construction time) to avoid stale
  snapshots missing freshly loaded profiles
- Match @mentions against first name of multi-word display names
- Fix sign-out dialog using deactivated widget context

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wesbillman
wesbillman merged commit 94d4e16 into main Apr 15, 2026
10 checks passed
@wesbillman
wesbillman deleted the feat/mobile-websocket-streaming branch April 15, 2026 03:20
kaalph pushed a commit to kaalph/buzz that referenced this pull request Aug 21, 2026
# By Wes (12) and others
# Via GitHub
* main: (26 commits)
  feat(mobile): websocket streaming with real-time messaging (block#323)
  feat(markdown): add image/video preview, lightbox, and multi-image gallery (block#316)
  feat(composer): add rich text editor with formatting and mentions (block#310)
  feat(mobile): align design language with desktop and polish UI (block#321)
  fix: lock file registry (block#318)
  feat(mobile): QR/code pairing flow with security hardening (block#317)
  feat: Sprout Huddles — voice conversations with AI agents (block#299)
  feat(mobile): add channel list with relay integration (block#315)
  feat: add change member role in channel sidebar (block#313)
  feat(desktop): deterministic nested thread panels (block#308)
  fix: show private channels in channel browser when user is a member (block#311)
  Replace inline channel creation with dialog (block#312)
  chore: improve chat message layout to left-aligned design (block#309)
  Add edit dialog for managed agents with relay profile sync (block#277)
  fix(ci): build relay with optimized profile to fix flaky e2e tests (block#307)
  Update actions/checkout action to v6 (block#305)
  Update dependency @tanstack/react-query to v5.98.0 (block#304)
  Update dependency @playwright/test to v1.59.1 (block#303)
  Update react monorepo to v19.2.5 (block#302)
  feat(mobile): scaffold Flutter app with Riverpod & Catppuccin theme (block#306)
  ...

# Conflicts:
#	desktop/src-tauri/Cargo.lock
#	desktop/src-tauri/Cargo.toml
#	desktop/src-tauri/src/lib.rs
#	desktop/src/features/channels/ui/ChannelScreen.tsx
kaalph pushed a commit to kaalph/buzz that referenced this pull request Aug 21, 2026
# By Wes (12) and others
# Via GitHub
* main: (26 commits)
  feat(mobile): websocket streaming with real-time messaging (block#323)
  feat(markdown): add image/video preview, lightbox, and multi-image gallery (block#316)
  feat(composer): add rich text editor with formatting and mentions (block#310)
  feat(mobile): align design language with desktop and polish UI (block#321)
  fix: lock file registry (block#318)
  feat(mobile): QR/code pairing flow with security hardening (block#317)
  feat: Sprout Huddles — voice conversations with AI agents (block#299)
  feat(mobile): add channel list with relay integration (block#315)
  feat: add change member role in channel sidebar (block#313)
  feat(desktop): deterministic nested thread panels (block#308)
  fix: show private channels in channel browser when user is a member (block#311)
  Replace inline channel creation with dialog (block#312)
  chore: improve chat message layout to left-aligned design (block#309)
  Add edit dialog for managed agents with relay profile sync (block#277)
  fix(ci): build relay with optimized profile to fix flaky e2e tests (block#307)
  Update actions/checkout action to v6 (block#305)
  Update dependency @tanstack/react-query to v5.98.0 (block#304)
  Update dependency @playwright/test to v1.59.1 (block#303)
  Update react monorepo to v19.2.5 (block#302)
  feat(mobile): scaffold Flutter app with Riverpod & Catppuccin theme (block#306)
  ...

# Conflicts:
#	desktop/src-tauri/Cargo.lock
#	desktop/src-tauri/Cargo.toml
#	desktop/src-tauri/src/lib.rs
#	desktop/src/features/channels/ui/ChannelScreen.tsx
BradGroux pushed a commit to BradGroux/buzz that referenced this pull request Aug 23, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant