feat(realtime): add ping/pong heartbeat and watchdog reconnect
Some checks failed
CI / test (push) Failing after 20s

- support ping incoming event and pong outgoing response
- add web heartbeat interval to keep ws alive
- add stale-connection watchdog to force reconnect on missing pong
This commit is contained in:
2026-03-08 02:13:34 +03:00
parent 46dc601c84
commit a9e4222062
3 changed files with 50 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ RealtimeEventName = Literal[
"message_delivered",
"user_online",
"user_offline",
"pong",
"error",
]
@@ -40,7 +41,7 @@ class MessageStatusPayload(BaseModel):
class IncomingRealtimeEvent(BaseModel):
event: Literal["send_message", "typing_start", "typing_stop", "message_read", "message_delivered"]
event: Literal["send_message", "typing_start", "typing_stop", "message_read", "message_delivered", "ping"]
payload: dict[str, Any]