Add comprehensive SignalR client implementation with connection management, React hooks, and UI components for real-time notifications and project updates. Changes: - Install @microsoft/signalr package (v9.0.6) - Create SignalR connection manager with auto-reconnect - Implement useNotificationHub hook for notification hub - Implement useProjectHub hook for project hub with room-based subscriptions - Add NotificationPopover UI component with badge and dropdown - Create Badge UI component - Add SignalRProvider for global connection initialization - Update Header to display real-time notifications - Update app layout to include SignalRProvider - Add comprehensive documentation in SIGNALR_INTEGRATION.md Features: - JWT authentication with automatic token management - Auto-reconnect with exponential backoff (0s, 2s, 5s, 10s, 30s) - Connection state management and indicators - Real-time notification push - Project event subscriptions (create, update, delete, status change) - Room-based project subscriptions - Typing indicators support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
14 lines
401 B
TypeScript
14 lines
401 B
TypeScript
export const SIGNALR_CONFIG = {
|
|
HUB_URLS: {
|
|
PROJECT: `${process.env.NEXT_PUBLIC_API_URL}/hubs/project`,
|
|
NOTIFICATION: `${process.env.NEXT_PUBLIC_API_URL}/hubs/notification`,
|
|
},
|
|
|
|
// 重连配置
|
|
RECONNECT_DELAYS: [0, 2000, 5000, 10000, 30000] as number[], // 0s, 2s, 5s, 10s, 30s
|
|
|
|
// 日志级别
|
|
LOG_LEVEL:
|
|
process.env.NODE_ENV === 'production' ? 'Warning' : 'Information',
|
|
};
|