From 9c66626198519ea84329b9831e60976d8d1abe5d Mon Sep 17 00:00:00 2001 From: thesyncim Date: Wed, 24 Apr 2024 18:35:07 +0100 Subject: [PATCH] introduce websocket reconnect strategy --- protobuf/video/sfu/event/events.proto | 2 ++ protobuf/video/sfu/models/models.proto | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/protobuf/video/sfu/event/events.proto b/protobuf/video/sfu/event/events.proto index 5cf7654d..36933b34 100644 --- a/protobuf/video/sfu/event/events.proto +++ b/protobuf/video/sfu/event/events.proto @@ -84,6 +84,8 @@ message PinsChanged { message Error { models.Error error = 4; + // returns the reconnect strategy to be used by the client + models.WebsocketReconnectStrategy reconnect_strategy = 5; } message ICETrickle { diff --git a/protobuf/video/sfu/models/models.proto b/protobuf/video/sfu/models/models.proto index 79753fe7..7de7bb07 100644 --- a/protobuf/video/sfu/models/models.proto +++ b/protobuf/video/sfu/models/models.proto @@ -267,4 +267,20 @@ enum CallEndedReason { CALL_ENDED_REASON_ENDED = 1; CALL_ENDED_REASON_LIVE_ENDED = 2; CALL_ENDED_REASON_KICKED = 3; -} \ No newline at end of file +} + +// WebsocketReconnectStrategy defines the ws strategies available for handling reconnections. +enum WebsocketReconnectStrategy { + WEBSOCKET_RECONNECT_STRATEGY_UNSPECIFIED = 0; + // Sent after reaching the maximum reconnection attempts, leading to a disconnection. + WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT = 1; + // SDK should maintaining existing publisher/subscriber pc instances + // and establish a new WebSocket connection. + WEBSOCKET_RECONNECT_STRATEGY_FAST = 2; + // SDK should drop existing pc instances and creates a fresh WebSocket connection, + // ensuring a clean state for the reconnection. + WEBSOCKET_RECONNECT_STRATEGY_CLEAN = 3; + // SDK should obtain new credentials from the coordinator, drops existing pc instances, and initializes + // a completely new WebSocket connection, ensuring a comprehensive reset. + WEBSOCKET_RECONNECT_STRATEGY_FULL = 4; +}; \ No newline at end of file