mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-12 16:37:06 +02:00
b6d03a1644b3e226505c1e9ccd90ae24f5e778d5
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>
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+Kto 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
Languages
TypeScript
98.9%
CSS
0.8%
JavaScript
0.3%