Merge WS v1 engine and web debug runtime-config integration
This commit is contained in:
@@ -87,6 +87,9 @@ class Settings(BaseSettings):
|
||||
# WebSocket heartbeat and inactivity
|
||||
inactivity_timeout_sec: int = Field(default=60, description="Close connection after no message from client (seconds)")
|
||||
heartbeat_interval_sec: int = Field(default=50, description="Send heartBeat event to client every N seconds")
|
||||
ws_protocol_version: str = Field(default="v1", description="Public WS protocol version")
|
||||
ws_api_key: Optional[str] = Field(default=None, description="Optional API key required for WS hello auth")
|
||||
ws_require_auth: bool = Field(default=False, description="Require auth in hello message even when ws_api_key is not set")
|
||||
|
||||
@property
|
||||
def chunk_size_bytes(self) -> int:
|
||||
|
||||
@@ -24,6 +24,7 @@ from core.transports import SocketTransport, WebRtcTransport, BaseTransport
|
||||
from core.session import Session
|
||||
from processors.tracks import Resampled16kTrack
|
||||
from core.events import get_event_bus, reset_event_bus
|
||||
from models.ws_v1 import ev
|
||||
|
||||
# Check interval for heartbeat/timeout (seconds)
|
||||
_HEARTBEAT_CHECK_INTERVAL_SEC = 5
|
||||
@@ -54,8 +55,7 @@ async def heartbeat_and_timeout_task(
|
||||
if now - last_heartbeat_at[0] >= heartbeat_interval_sec:
|
||||
try:
|
||||
await transport.send_event({
|
||||
"event": "heartBeat",
|
||||
"timestamp": int(time.time() * 1000),
|
||||
**ev("heartbeat"),
|
||||
})
|
||||
last_heartbeat_at[0] = now
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user