Alejandro Gómez b6d03a1644 fix: Use persistent subscription instead of request for real-time DMs
CRITICAL FIX: Changed from pool.request() to pool.subscription() to keep
the relay connection open after EOSE. This was the root cause of why
received messages didn't appear automatically.

**Root Cause:**

1. pool.request() fetches historical events and CLOSES after EOSE
2. After EOSE, relay subscription is terminated
3. New gift wraps sent after that aren't received from relay
4. EventStore timeline subscription only fires when events are added
5. Result: Only locally-sent messages appeared (added to EventStore),
   but remotely-received messages were invisible until manual sync

**Solution:**

Use pool.subscription() which keeps the WebSocket connection OPEN after
EOSE, allowing real-time message delivery.

**Changes:**

src/services/gift-wrap.ts:
* Changed pool.request() to pool.subscription()
* Added detailed logging for EVENT and EOSE responses
* Properly stores relay subscription in subscriptions array for cleanup
* Connection stays open indefinitely for real-time updates

**Expected Behavior:**

After EOSE:
-  Relay connection stays open (WebSocket active)
-  New gift wraps received in real-time from relay
-  EventStore.add() called automatically (via eventStore option)
-  Timeline subscription fires
-  Message appears in UI within 500ms

Console logs should show:
1. 'Opening subscription to X relays for real-time gift wraps'
2. '✓ EOSE from wss://relay... (subscription stays open)'
3. '📨 Received gift wrap xxxxxx from relay' (when message arrives)
4. '📬 Timeline subscription fired with X gift wraps'
5. '💬 Updated conversations: X conversations, X total rumors'

**Testing:**

1. Login and open self-chat
2. Send message from another client/device
3. Message should appear automatically within 500ms
4. No manual sync needed
5. Works for both self-chat and regular DMs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-16 14:34:25 +01:00
2025-12-18 15:46:02 +01:00
👶
2025-12-09 16:26:31 +01:00
2025-12-19 12:49:29 +01:00
2025-12-13 15:06:05 +01:00
2025-12-10 13:00:39 +01:00
2025-12-22 20:40:16 +00:00
2025-12-20 14:25:40 +01:00
2026-01-14 19:24:37 +01:00
👶
2025-12-09 16:26:31 +01:00
👶
2025-12-09 16:26:31 +01:00
👶
2025-12-09 16:26:31 +01:00
👶
2025-12-09 16:26:31 +01:00
2025-12-14 16:50:16 +01:00

Grimoire

A Nostr protocol explorer and developer tool with a tiling window manager interface.

Features

  • Tiling Windows - Each window is a Nostr "app" (profile viewer, event feed, NIP docs, etc.)
  • Command Palette - Unix-style commands via Cmd+K to open apps and navigate
  • Multi-workspace - Virtual desktops with independent layouts
  • Real-time - Reactive event subscriptions with automatic updates

Stack

React 19, TypeScript, Vite, TailwindCSS, Jotai, Dexie, Applesauce

Getting Started

npm install
npm run dev

Scripts

Command Description
npm run dev Start dev server
npm run build Build for production
npm test Run tests in watch mode
npm run lint Lint code
npm run format Format code

License

MIT

Description
No description provided
Readme MIT 14 MiB
Languages
TypeScript 98.9%
CSS 0.8%
JavaScript 0.3%