- Added configuration options for polling fallback and polling interval to the WebSocket service, enabling a backup mechanism for real-time updates when WebSocket connections fail. - Implemented detailed logging for WebSocket events, including connection status, message handling, and error diagnostics, to improve monitoring and debugging capabilities. - Updated connection handling to manage polling effectively, ensuring users receive timely updates even during WebSocket disruptions. These changes enhance the reliability and transparency of the WalletWebSocketService, contributing to a better user experience.
97 lines
No EOL
2.6 KiB
TypeScript
97 lines
No EOL
2.6 KiB
TypeScript
import type { AppConfig } from './core/types'
|
|
|
|
export const appConfig: AppConfig = {
|
|
modules: {
|
|
base: {
|
|
name: 'base',
|
|
enabled: true,
|
|
lazy: false,
|
|
config: {
|
|
nostr: {
|
|
relays: JSON.parse(import.meta.env.VITE_NOSTR_RELAYS || '["wss://relay.damus.io", "wss://nos.lol"]')
|
|
},
|
|
auth: {
|
|
sessionTimeout: 24 * 60 * 60 * 1000, // 24 hours
|
|
},
|
|
pwa: {
|
|
autoPrompt: true
|
|
}
|
|
}
|
|
},
|
|
'nostr-feed': {
|
|
name: 'nostr-feed',
|
|
enabled: true,
|
|
lazy: false,
|
|
config: {
|
|
refreshInterval: 30000, // 30 seconds
|
|
maxPosts: 100,
|
|
adminPubkeys: JSON.parse(import.meta.env.VITE_ADMIN_PUBKEYS || '[]'),
|
|
feedTypes: ['announcements', 'general']
|
|
}
|
|
},
|
|
market: {
|
|
name: 'market',
|
|
enabled: true,
|
|
lazy: false,
|
|
config: {
|
|
defaultCurrency: 'sats',
|
|
paymentTimeout: 300000, // 5 minutes
|
|
maxOrderHistory: 50,
|
|
apiConfig: {
|
|
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000'
|
|
}
|
|
}
|
|
},
|
|
chat: {
|
|
name: 'chat',
|
|
enabled: true,
|
|
lazy: false, // Load on startup to register routes
|
|
config: {
|
|
maxMessages: 500,
|
|
autoScroll: true,
|
|
showTimestamps: true
|
|
}
|
|
},
|
|
events: {
|
|
name: 'events',
|
|
enabled: true,
|
|
lazy: false,
|
|
config: {
|
|
apiConfig: {
|
|
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000',
|
|
apiKey: import.meta.env.VITE_API_KEY || ''
|
|
},
|
|
ticketValidationEndpoint: '/api/tickets/validate',
|
|
maxTicketsPerUser: 10
|
|
}
|
|
},
|
|
wallet: {
|
|
name: 'wallet',
|
|
enabled: true,
|
|
lazy: false,
|
|
config: {
|
|
defaultReceiveAmount: 1000, // 1000 sats
|
|
maxReceiveAmount: 1000000, // 1M sats
|
|
apiConfig: {
|
|
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000'
|
|
},
|
|
websocket: {
|
|
enabled: import.meta.env.VITE_WEBSOCKET_ENABLED !== 'false', // Can be disabled via env var
|
|
reconnectDelay: 2000, // 2 seconds (increased from 1s to reduce server load)
|
|
maxReconnectAttempts: 3, // Reduced from 5 to avoid overwhelming server
|
|
fallbackToPolling: true, // Enable polling fallback when WebSocket fails
|
|
pollingInterval: 10000 // 10 seconds for polling updates
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
features: {
|
|
pwa: true,
|
|
pushNotifications: true,
|
|
electronApp: false,
|
|
developmentMode: import.meta.env.DEV
|
|
}
|
|
}
|
|
|
|
export default appConfig |