Add VisibilityService documentation and integration guide
- Create comprehensive documentation for the new VisibilityService, detailing its purpose, core concepts, and architecture. - Include an integration guide for module developers, outlining best practices for registering services and handling app visibility changes. - Add example code snippets for implementing visibility management in various service types, ensuring clarity and ease of use. - Introduce a troubleshooting section to address common issues and provide debugging tips for developers. - Enhance the VisibilityService integration guide with real-world examples to illustrate practical usage scenarios.
This commit is contained in:
parent
3e9c9bbdef
commit
d03a1fcd2c
3 changed files with 1139 additions and 0 deletions
11
CLAUDE.md
11
CLAUDE.md
|
|
@ -80,6 +80,7 @@ const relayHub = injectService(SERVICE_TOKENS.RELAY_HUB)
|
|||
- `SERVICE_TOKENS.RELAY_HUB` - Centralized Nostr relay management
|
||||
- `SERVICE_TOKENS.NOSTR_CLIENT_HUB` - Nostr client services
|
||||
- `SERVICE_TOKENS.AUTH_SERVICE` - Authentication services
|
||||
- `SERVICE_TOKENS.VISIBILITY_SERVICE` - App visibility and connection management
|
||||
|
||||
**Core Stack:**
|
||||
- Vue 3 with Composition API (`<script setup>` style)
|
||||
|
|
@ -159,6 +160,16 @@ export const myModule: ModulePlugin = {
|
|||
- Base module provides core infrastructure services
|
||||
- Modules can register their own services in the DI container
|
||||
|
||||
**⚠️ CRITICAL - WebSocket Connection Management:**
|
||||
- **ALWAYS integrate with VisibilityService for any module that uses WebSocket connections**
|
||||
- All services extending `BaseService` have automatic access to `this.visibilityService`
|
||||
- Register visibility callbacks during service initialization: `this.visibilityService.registerService(name, onResume, onPause)`
|
||||
- Implement proper connection recovery in `onResume()` handler (check health, reconnect if needed, restore subscriptions)
|
||||
- Implement battery-conscious pausing in `onPause()` handler (stop heartbeats, queue operations)
|
||||
- **Mobile browsers suspend WebSocket connections when app loses visibility** - visibility management is essential for reliable real-time features
|
||||
- See `docs/VisibilityService.md` and `docs/VisibilityService-Integration.md` for comprehensive integration guides
|
||||
- Future modules will likely ALL depend on WebSocket connections - plan for visibility management from the start
|
||||
|
||||
### **Centralized Infrastructure**
|
||||
|
||||
**Nostr Relay Management:**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue