mirror of
https://github.com/azaion/gps-denied-desktop.git
synced 2026-04-23 01:56:36 +00:00
fix issues
This commit is contained in:
@@ -28,9 +28,19 @@ class ISSEEventStreamer(ABC):
|
||||
def send_refinement(self, flight_id: str, frame_id: int, updated_result: FrameResult) -> bool:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def send_heartbeat(self, flight_id: str) -> bool:
|
||||
"""Sends heartbeat/keepalive to all clients subscribed to flight."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def close_stream(self, flight_id: str, client_id: str) -> bool:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_active_connections(self, flight_id: str) -> int:
|
||||
"""Returns count of active SSE connections for a flight."""
|
||||
pass
|
||||
```
|
||||
|
||||
## Component Description
|
||||
@@ -170,12 +180,50 @@ StreamConnection:
|
||||
|
||||
---
|
||||
|
||||
### `send_heartbeat(flight_id: str) -> bool`
|
||||
|
||||
**Description**: Sends heartbeat/keepalive ping to all clients subscribed to a flight. Keeps connections alive and helps detect stale connections.
|
||||
|
||||
**Called By**:
|
||||
- Background heartbeat task (every 30 seconds)
|
||||
- F02 Flight Processor (periodically during processing)
|
||||
|
||||
**Event Format**:
|
||||
```
|
||||
:heartbeat
|
||||
```
|
||||
|
||||
**Behavior**:
|
||||
- Sends SSE comment (`:heartbeat`) which doesn't trigger event handlers
|
||||
- Keeps TCP connection alive
|
||||
- Client can use to detect connection health
|
||||
|
||||
**Test Cases**:
|
||||
1. Send heartbeat → all clients receive ping
|
||||
2. Client timeout → connection marked stale
|
||||
|
||||
---
|
||||
|
||||
### `close_stream(flight_id: str, client_id: str) -> bool`
|
||||
|
||||
**Description**: Closes SSE connection.
|
||||
|
||||
**Called By**: F01 REST API (on client disconnect)
|
||||
|
||||
---
|
||||
|
||||
### `get_active_connections(flight_id: str) -> int`
|
||||
|
||||
**Description**: Returns count of active SSE connections for a flight.
|
||||
|
||||
**Called By**:
|
||||
- F02 Flight Processor (monitoring)
|
||||
- Admin tools
|
||||
|
||||
**Test Cases**:
|
||||
1. No connections → returns 0
|
||||
2. 5 clients connected → returns 5
|
||||
|
||||
## Integration Tests
|
||||
|
||||
### Test 1: Real-Time Streaming
|
||||
|
||||
Reference in New Issue
Block a user