From 5e8c0417d53a1a51f85f527c757e8030a3240ae7 Mon Sep 17 00:00:00 2001 From: Ryan Gaus Date: Fri, 13 Nov 2026 11:48:29 +1300 Subject: [PATCH] Add DataChannelRpcConnectionClosed (1506) RPC error code Mirrors CONNECTION_CLOSED from the JS SDK (livekit/client-sdk-js#2251) and ConnectionClosed from the Rust SDK (livekit/rust-sdks#1671): a call fails with it when the caller's own room disconnects while the call is in flight. --- .changeset/rpc-connection-closed-error-code.md | 5 +++++ utils/data_channel_rpc.go | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changeset/rpc-connection-closed-error-code.md diff --git a/.changeset/rpc-connection-closed-error-code.md b/.changeset/rpc-connection-closed-error-code.md new file mode 100644 index 000000000..352b66adb --- /dev/null +++ b/.changeset/rpc-connection-closed-error-code.md @@ -0,0 +1,5 @@ +--- +"@livekit/protocol": patch +--- + +Add the `DataChannelRpcConnectionClosed` (1506, "Connection closed") data channel RPC error code, used by the client SDKs when the caller's own room disconnects while a call is in flight diff --git a/utils/data_channel_rpc.go b/utils/data_channel_rpc.go index 104a59690..a06b13367 100644 --- a/utils/data_channel_rpc.go +++ b/utils/data_channel_rpc.go @@ -16,6 +16,7 @@ const ( DataChannelRpcRecipientDisconnected DataChannelRpcResponsePayloadTooLarge DataChannelRpcSendFailed + DataChannelRpcConnectionClosed ) const ( @@ -41,6 +42,7 @@ var dataChannelRpcErrorMessages = map[DataChannelRpcErrorCode]string{ DataChannelRpcRecipientDisconnected: "Recipient disconnected", DataChannelRpcResponsePayloadTooLarge: "Response payload too large", DataChannelRpcSendFailed: "Failed to send", + DataChannelRpcConnectionClosed: "Connection closed", DataChannelRpcUnsupportedMethod: "Method not supported at destination", DataChannelRpcRecipientNotFound: "Recipient not found", @@ -76,6 +78,8 @@ func (e *DataChannelRpcError) PsrpcError() psrpc.Error { return psrpc.NewError(psrpc.MalformedResponse, e) case DataChannelRpcSendFailed: return psrpc.NewError(psrpc.Internal, e) + case DataChannelRpcConnectionClosed: + return psrpc.NewError(psrpc.Unavailable, e) case DataChannelRpcUnsupportedMethod: return psrpc.NewError(psrpc.InvalidArgument, e) case DataChannelRpcRecipientNotFound: