Add Server-Sent Events (SSE) support for Home Assistant integration

- Implemented comprehensive SSE manager with advanced client management
- Added dynamic event subscription and broadcasting capabilities
- Created robust rate limiting and client connection tracking
- Enhanced Home Assistant event handling with new SSE endpoints
- Updated package.json with UUID dependency for client identification
- Expanded test coverage for SSE and WebSocket event handling
- Improved type definitions for Home Assistant events and entities
This commit is contained in:
jango-blockchained
2025-01-30 11:42:19 +01:00
parent 70c9287c68
commit 64e619252c
8 changed files with 872 additions and 196 deletions

View File

@@ -109,7 +109,11 @@ describe('WebSocket Event Handling', () => {
attributes: { brightness: 255 },
last_changed: '2024-01-01T00:00:00Z',
last_updated: '2024-01-01T00:00:00Z',
context: { id: '123' }
context: {
id: '123',
parent_id: null,
user_id: null
}
},
old_state: {
entity_id: 'light.living_room',
@@ -117,12 +121,20 @@ describe('WebSocket Event Handling', () => {
attributes: {},
last_changed: '2024-01-01T00:00:00Z',
last_updated: '2024-01-01T00:00:00Z',
context: { id: '122' }
context: {
id: '122',
parent_id: null,
user_id: null
}
}
},
origin: 'LOCAL',
time_fired: '2024-01-01T00:00:00Z',
context: { id: '123' }
context: {
id: '123',
parent_id: null,
user_id: null
}
};
client.on('event', (event) => {