From 909896adf7ab664c56ecae2edfb41ef83a48ab77 Mon Sep 17 00:00:00 2001 From: thesyncim Date: Wed, 10 Jul 2024 11:48:54 +0100 Subject: [PATCH 1/2] simplify reconnect strategy --- protobuf/video/sfu/models/models.pb.go | 54 +++++++++++--------------- protobuf/video/sfu/models/models.proto | 9 ++--- 2 files changed, 26 insertions(+), 37 deletions(-) diff --git a/protobuf/video/sfu/models/models.pb.go b/protobuf/video/sfu/models/models.pb.go index a43cb4c4..183a8425 100644 --- a/protobuf/video/sfu/models/models.pb.go +++ b/protobuf/video/sfu/models/models.pb.go @@ -572,7 +572,7 @@ type WebsocketReconnectStrategy int32 const ( WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_UNSPECIFIED WebsocketReconnectStrategy = 0 - // Sent after reaching the maximum reconnection attempts, leading to permanent disconnect. + // Sent after reaching the maximum reconnection attempts, or any other unrecoverable error leading to permanent disconnect. WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT WebsocketReconnectStrategy = 1 // SDK should maintaining existing publisher/subscriber pc instances // and establish a new WebSocket connection. @@ -580,12 +580,9 @@ const ( // SDK should drop existing pc instances and creates a fresh WebSocket connection, // ensuring a clean state for the reconnection. WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_CLEAN WebsocketReconnectStrategy = 3 - // SDK should obtain new credentials from the coordinator, drops existing pc instances, and initializes + // SDK should obtain new credentials from the coordinator, drops existing pc instances, set a new session_id and initializes // a completely new WebSocket connection, ensuring a comprehensive reset. - WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_FULL WebsocketReconnectStrategy = 4 - // SDK should obtain new credentials from the coordinator,excluding current SFU, drops existing pc instances, and initializes - // a completely new WebSocket connection, ensuring a comprehensive reset. - WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_FULL_NEW_SFU WebsocketReconnectStrategy = 5 + WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_REJOIN WebsocketReconnectStrategy = 5 // SDK should migrate to a new SFU instance WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_MIGRATE WebsocketReconnectStrategy = 6 ) @@ -597,18 +594,16 @@ var ( 1: "WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT", 2: "WEBSOCKET_RECONNECT_STRATEGY_FAST", 3: "WEBSOCKET_RECONNECT_STRATEGY_CLEAN", - 4: "WEBSOCKET_RECONNECT_STRATEGY_FULL", - 5: "WEBSOCKET_RECONNECT_STRATEGY_FULL_NEW_SFU", + 5: "WEBSOCKET_RECONNECT_STRATEGY_REJOIN", 6: "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE", } WebsocketReconnectStrategy_value = map[string]int32{ - "WEBSOCKET_RECONNECT_STRATEGY_UNSPECIFIED": 0, - "WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT": 1, - "WEBSOCKET_RECONNECT_STRATEGY_FAST": 2, - "WEBSOCKET_RECONNECT_STRATEGY_CLEAN": 3, - "WEBSOCKET_RECONNECT_STRATEGY_FULL": 4, - "WEBSOCKET_RECONNECT_STRATEGY_FULL_NEW_SFU": 5, - "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE": 6, + "WEBSOCKET_RECONNECT_STRATEGY_UNSPECIFIED": 0, + "WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT": 1, + "WEBSOCKET_RECONNECT_STRATEGY_FAST": 2, + "WEBSOCKET_RECONNECT_STRATEGY_CLEAN": 3, + "WEBSOCKET_RECONNECT_STRATEGY_REJOIN": 5, + "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE": 6, } ) @@ -2290,7 +2285,7 @@ var file_video_sfu_models_models_proto_rawDesc = []byte{ 0x45, 0x4e, 0x44, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4b, 0x49, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x03, 0x12, 0x23, 0x0a, 0x1f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x45, 0x4e, 0x44, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, - 0x4f, 0x4e, 0x5f, 0x45, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x04, 0x2a, 0xc6, 0x02, 0x0a, 0x1a, 0x57, + 0x4f, 0x4e, 0x5f, 0x45, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x04, 0x2a, 0x99, 0x02, 0x0a, 0x1a, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x2c, 0x0a, 0x28, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, @@ -2303,22 +2298,19 @@ var file_video_sfu_models_models_proto_rawDesc = []byte{ 0x54, 0x45, 0x47, 0x59, 0x5f, 0x46, 0x41, 0x53, 0x54, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x43, 0x4c, 0x45, 0x41, - 0x4e, 0x10, 0x03, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, + 0x4e, 0x10, 0x03, 0x12, 0x27, 0x0a, 0x23, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, - 0x45, 0x47, 0x59, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, 0x04, 0x12, 0x2d, 0x0a, 0x29, 0x57, 0x45, - 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, - 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x5f, - 0x4e, 0x45, 0x57, 0x5f, 0x53, 0x46, 0x55, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, 0x57, 0x45, 0x42, - 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, - 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, - 0x45, 0x10, 0x06, 0x42, 0x65, 0x42, 0x0b, 0x53, 0x66, 0x75, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, - 0x56, 0x31, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x69, 0x64, - 0x65, 0x6f, 0x2f, 0x73, 0x66, 0x75, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0xaa, 0x02, 0x1a, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x66, 0x75, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x45, 0x47, 0x59, 0x5f, 0x52, 0x45, 0x4a, 0x4f, 0x49, 0x4e, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, + 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, + 0x45, 0x43, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x4d, 0x49, 0x47, + 0x52, 0x41, 0x54, 0x45, 0x10, 0x06, 0x42, 0x65, 0x42, 0x0b, 0x53, 0x66, 0x75, 0x4d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x76, 0x69, 0x64, 0x65, 0x6f, 0x2f, 0x73, 0x66, 0x75, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0xaa, 0x02, 0x1a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x2e, + 0x76, 0x31, 0x2e, 0x53, 0x66, 0x75, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protobuf/video/sfu/models/models.proto b/protobuf/video/sfu/models/models.proto index db4126c3..a8b9c90c 100644 --- a/protobuf/video/sfu/models/models.proto +++ b/protobuf/video/sfu/models/models.proto @@ -273,7 +273,7 @@ enum CallEndedReason { // 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 permanent disconnect. + // Sent after reaching the maximum reconnection attempts, or any other unrecoverable error leading to permanent disconnect. WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT = 1; // SDK should maintaining existing publisher/subscriber pc instances // and establish a new WebSocket connection. @@ -281,12 +281,9 @@ enum WebsocketReconnectStrategy { // 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 + // SDK should obtain new credentials from the coordinator, drops existing pc instances, set a new session_id and initializes // a completely new WebSocket connection, ensuring a comprehensive reset. - WEBSOCKET_RECONNECT_STRATEGY_FULL = 4; - // SDK should obtain new credentials from the coordinator,excluding current SFU, drops existing pc instances, and initializes - // a completely new WebSocket connection, ensuring a comprehensive reset. - WEBSOCKET_RECONNECT_STRATEGY_FULL_NEW_SFU = 5; + WEBSOCKET_RECONNECT_STRATEGY_REJOIN = 5; // SDK should migrate to a new SFU instance WEBSOCKET_RECONNECT_STRATEGY_MIGRATE = 6; }; From 347731f6282f2ef0575148642b3d8daf67b10a68 Mon Sep 17 00:00:00 2001 From: thesyncim Date: Wed, 10 Jul 2024 11:52:50 +0100 Subject: [PATCH 2/2] fix enum indexes --- protobuf/video/sfu/models/models.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protobuf/video/sfu/models/models.proto b/protobuf/video/sfu/models/models.proto index a8b9c90c..27a3382a 100644 --- a/protobuf/video/sfu/models/models.proto +++ b/protobuf/video/sfu/models/models.proto @@ -283,7 +283,7 @@ enum WebsocketReconnectStrategy { WEBSOCKET_RECONNECT_STRATEGY_CLEAN = 3; // SDK should obtain new credentials from the coordinator, drops existing pc instances, set a new session_id and initializes // a completely new WebSocket connection, ensuring a comprehensive reset. - WEBSOCKET_RECONNECT_STRATEGY_REJOIN = 5; + WEBSOCKET_RECONNECT_STRATEGY_REJOIN = 4; // SDK should migrate to a new SFU instance - WEBSOCKET_RECONNECT_STRATEGY_MIGRATE = 6; + WEBSOCKET_RECONNECT_STRATEGY_MIGRATE = 5; };