Enhance VisibilityService integration for WebSocket and chat services
- Add detailed examples for WebSocket connection recovery and chat message synchronization in the VisibilityService documentation. - Refactor ChatService to register with VisibilityService, enabling automatic handling of app visibility changes and missed message synchronization. - Implement connection recovery logic in NostrclientHub and ChatService to ensure seamless user experience during app backgrounding. - Update base module to ensure proper initialization of services with VisibilityService dependencies, enhancing overall connection management.
This commit is contained in:
parent
d03a1fcd2c
commit
ef7333e68e
5 changed files with 756 additions and 121 deletions
|
|
@ -56,6 +56,10 @@ export const baseModule: ModulePlugin = {
|
|||
waitForDependencies: false, // VisibilityService has no dependencies
|
||||
maxRetries: 1
|
||||
})
|
||||
await nostrclientHub.initialize({
|
||||
waitForDependencies: true, // NostrClientHub depends on VisibilityService
|
||||
maxRetries: 3
|
||||
})
|
||||
|
||||
console.log('✅ Base module installed successfully')
|
||||
},
|
||||
|
|
@ -63,9 +67,12 @@ export const baseModule: ModulePlugin = {
|
|||
async uninstall() {
|
||||
console.log('🗑️ Uninstalling base module...')
|
||||
|
||||
// Cleanup Nostr connections
|
||||
relayHub.disconnect()
|
||||
nostrclientHub.disconnect?.()
|
||||
// Cleanup services
|
||||
await relayHub.dispose()
|
||||
await nostrclientHub.dispose()
|
||||
await auth.dispose()
|
||||
await paymentService.dispose()
|
||||
await visibilityService.dispose()
|
||||
|
||||
console.log('✅ Base module uninstalled')
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue