Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour for connectionState when reconnecting #410

Open
JohannesWarn opened this issue Jun 24, 2024 · 3 comments
Open

Unexpected behaviour for connectionState when reconnecting #410

JohannesWarn opened this issue Jun 24, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JohannesWarn
Copy link

JohannesWarn commented Jun 24, 2024

Describe the bug
When attempting to reconnect the connectionState remains as .connected until all retry attempts have been exhausted.

SDK Version
2.0.10

iOS Version
17.5.1

Steps to Reproduce

  1. Build the Swift example project (https://github.com/livekit-examples/swift-example).
  2. Connect two devices
  3. Simulate a bad connection on one device by enabling the 100% Loss profile in Network Link Conditioner.

Expected behavior
The connectionState changes to .reconnecting on the first reconnect attempt.

Observed behavior
The connectionState stays as .connected while the retry attempts are exhausted. The connectionState then changes to .reconnecting, and then to .disconnected.

Logs

Relevant logs:

[Retry] Attempt 1 of 3, delay: 2.0
[Retry] Waiting for 2.0 seconds...
[Retry] Attempt 2 of 3, delay: 2.0
[Retry] Waiting for 2.0 seconds...
Did update connectionState .connected -> .reconnecting
Did update connectionState .reconnecting -> .disconnected

Full logs if that would be of any help:

2024-06-24T10:49:00+0100 debug LiveKitSDK : [LiveKit] AppStateListener.init() UIApplication.didEnterBackground
Snapshotting a view (0x105820600, UIKeyboardImpl) that has not been rendered at least once requires afterScreenUpdates:YES.
2024-06-24T10:49:00+0100 debug LiveKitSDK : [LiveKit] ConnectivityListener.set(path:notify:) status: satisfied, interfaces: ["wifi-17", "cellular-3"], gateways: [192.168.0.1:0], activeIp: Optional("192.168.0.229")
2024-06-24T10:49:03+0100 debug LiveKitSDK : [LiveKit] AppStateListener.init() UIApplication.willEnterForeground
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] Transport.peerConnection(_:didChange:) [Connect] Transport(subscriber) did update state: .disconnected
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] Engine.transport(_:didUpdateState:) target: subscriber, connectionState: .disconnected
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Starting, reason: transport
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] Engine.init(connectOptions:) connectionState: .connected -> .connected, reconnectMode: Optional(.quick)
[Retry] Attempt 1 of 3, delay: 2.0
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Retry in 2.0 seconds, 1/3 tries left.
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] Engine.quickReconnectSequence() [Connect] Starting .quick reconnect sequence...
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: nil
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) Did exit WebSocket message loop...
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .connected -> .disconnected
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) [Connect] mode: .quick
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] WebSocket.urlSession(_:task:didCompleteWithError:) didCompleteWithError: nil
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) [Connect] with url: wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1
2024-06-24T10:49:06+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .disconnected -> .reconnecting
nw_socket_copy_info [C6.1.1:3] Can't get TCP_INFO on a multipath socket
nw_socket_copy_info [C6.1.1:3] Can't get TCP_CONNECTION_INFO on a multipath socket
Task <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1>, NSLocalizedDescription=The request timed out.}
2024-06-24T10:49:16+0100 error LiveKitSDK : [LiveKit] WebSocket.urlSession(_:task:didCompleteWithError:) didCompleteWithError: Optional(Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1>, NSLocalizedDescription=The request timed out.})
2024-06-24T10:49:16+0100 debug LiveKitSDK : [LiveKit] LiveKitError.from(error:) Uncategorized error for: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <E8B9010B-0F5D-4A42-9EE8-A7A40091D6A2>.<1>, NSLocalizedDescription=The request timed out.}
2024-06-24T10:49:16+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: Optional(Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown})
2024-06-24T10:49:16+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .reconnecting -> .disconnected
2024-06-24T10:49:16+0100 error LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Reconnect mode: .quick failed with error: Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown}
[Retry] Waiting for 2.0 seconds...
2024-06-24T10:49:16+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Starting, reason: websocket
2024-06-24T10:49:16+0100 warning LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Reconnect already in progress...
2024-06-24T10:49:16+0100 error LiveKitSDK : [LiveKit] Engine.signalClient(_:didUpdateConnectionState:oldState:disconnectError:) Failed calling startReconnect, error: Error Domain=io.livekit.swift-sdk Code=104 "Invalid state" UserInfo={NSLocalizedDescription=Invalid state}
nw_socket_copy_info [C8.1.1:3] Can't get TCP_INFO on a multipath socket
nw_socket_copy_info [C8.1.1:3] Can't get TCP_CONNECTION_INFO on a multipath socket
nw_socket_copy_info [C8.1.2:3] Can't get TCP_INFO on a multipath socket
nw_socket_copy_info [C8.1.2:3] Can't get TCP_CONNECTION_INFO on a multipath socket
2024-06-24T10:49:16+0100 debug LiveKitSDK : [LiveKit] Transport.peerConnection(_:didChange:) [Connect] Transport(subscriber) did update state: .failed
[Retry] Attempt 2 of 3, delay: 2.0
2024-06-24T10:49:18+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Retry in 2.0 seconds, 2/3 tries left.
2024-06-24T10:49:18+0100 debug LiveKitSDK : [LiveKit] Engine.quickReconnectSequence() [Connect] Starting .quick reconnect sequence...
2024-06-24T10:49:18+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: nil
2024-06-24T10:49:18+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) [Connect] mode: .quick
2024-06-24T10:49:18+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) [Connect] with url: wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1
2024-06-24T10:49:18+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .disconnected -> .reconnecting
Task <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1>, NSLocalizedDescription=The request timed out.}
2024-06-24T10:49:28+0100 error LiveKitSDK : [LiveKit] WebSocket.urlSession(_:task:didCompleteWithError:) didCompleteWithError: Optional(Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1>, NSLocalizedDescription=The request timed out.})
2024-06-24T10:49:28+0100 debug LiveKitSDK : [LiveKit] LiveKitError.from(error:) Uncategorized error for: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=1&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <AF0A1A9E-1FEC-4D42-9EB8-DF85A1125C23>.<1>, NSLocalizedDescription=The request timed out.}
nw_socket_copy_info [C9.1.1:3] Can't get TCP_INFO on a multipath socket
2024-06-24T10:49:28+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: Optional(Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown})
2024-06-24T10:49:28+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .reconnecting -> .disconnected
nw_socket_copy_info [C9.1.1:3] Can't get TCP_CONNECTION_INFO on a multipath socket
2024-06-24T10:49:28+0100 error LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Reconnect mode: .quick failed with error: Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown}
[Retry] Waiting for 2.0 seconds...
nw_socket_copy_info [C9.1.2:3] Can't get TCP_INFO on a multipath socket
2024-06-24T10:49:28+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Starting, reason: websocket
nw_socket_copy_info [C9.1.2:3] Can't get TCP_CONNECTION_INFO on a multipath socket
2024-06-24T10:49:28+0100 warning LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Reconnect already in progress...
2024-06-24T10:49:28+0100 error LiveKitSDK : [LiveKit] Engine.signalClient(_:didUpdateConnectionState:oldState:disconnectError:) Failed calling startReconnect, error: Error Domain=io.livekit.swift-sdk Code=104 "Invalid state" UserInfo={NSLocalizedDescription=Invalid state}
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Retry in 2.0 seconds, 3/3 tries left.
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] Engine.init(connectOptions:) connectionState: .connected -> .connected, reconnectMode: Optional(.full)
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] Engine.fullReconnectSequence() [Connect] starting .full reconnect sequence...
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] Engine.init(connectOptions:) connectionState: .connected -> .reconnecting, reconnectMode: Optional(.full)
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] Room.cleanUp(withError:isFullReconnect:) withError: nil
Did update connectionState .connected -> .reconnecting
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: nil
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] Room.cleanUpParticipants(isFullReconnect:notify:) notify: true
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: nil
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) [Connect] mode: .full
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] SignalClient.connect(_:_:connectOptions:reconnectMode:adaptiveStream:) [Connect] with url: wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1
2024-06-24T10:49:30+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .disconnected -> .reconnecting
Task <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1>, NSLocalizedDescription=The request timed out.}
2024-06-24T10:49:40+0100 error LiveKitSDK : [LiveKit] WebSocket.urlSession(_:task:didCompleteWithError:) didCompleteWithError: Optional(Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1>, NSLocalizedDescription=The request timed out.})
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] LiveKitError.from(error:) Uncategorized error for: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1, NSErrorFailingURLKey=wss://instant-8958f7ng.livekit.cloud/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTkyMjg4NzEsImlzcyI6IkFQSWo0VUxDSmVBd3dyRiIsIm5iZiI6MTcxOTIyMTY3MSwic3ViIjoicXVpY2tzdGFydCB1c2VyIHoyMW9tYyIsInZpZGVvIjp7ImNhblB1Ymxpc2giOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsInJvb20iOiJxdWlja3N0YXJ0IHJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.-CUFy1CCb8g2wv3EGCWhbuhFd5GjDbsukD_a59B9hf0&protocol=12&sdk=swift&version=2.0.10&os=iOS&os_version=17.5.1&device_model=iPhone14,4&network=wifi&reconnect=0&auto_subscribe=1&adaptive_stream=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <B731EA41-FC5D-4AD8-B626-4A901A3FF0F4>.<1>, NSLocalizedDescription=The request timed out.}
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: Optional(Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown})
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] SignalClient.connectionState .reconnecting -> .disconnected
2024-06-24T10:49:40+0100 error LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Reconnect mode: .full failed with error: Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown}
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] Engine.startReconnect(reason:nextReconnectMode:) [Connect] Sequence failed with error: Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown}
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] Room.cleanUp(withError:isFullReconnect:) withError: Optional(Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown})
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] Engine.init(connectOptions:) connectionState: .reconnecting -> .disconnected, reconnectMode: nil
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] SignalClient.cleanUp(withError:) withError: Optional(Error Domain=io.livekit.swift-sdk Code=0 "Unknown" UserInfo={NSLocalizedDescription=Unknown})
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] Room.cleanUpParticipants(isFullReconnect:notify:) notify: true
Did update connectionState .reconnecting -> .disconnected
nw_socket_copy_info [C10.1.1:3] Can't get TCP_INFO on a multipath socket
nw_socket_copy_info [C10.1.1:3] Can't get TCP_CONNECTION_INFO on a multipath socket
nw_socket_copy_info [C10.1.2:3] Can't get TCP_INFO on a multipath socket
nw_socket_copy_info [C10.1.2:3] Can't get TCP_CONNECTION_INFO on a multipath socket
2024-06-24T10:49:40+0100 debug LiveKitSDK : [LiveKit] Engine.transport(_:didUpdateState:) target: subscriber, connectionState: .failed
No color named 'lkRed' found in asset catalog for main bundle (/private/var/containers/Bundle/Application/7BD693F9-F915-4723-91D6-0A6FD3306806/LiveKitExample.app)
2024-06-24T10:53:33+0100 debug LiveKitSDK : [LiveKit] AppStateListener.init() UIApplication.didEnterBackground
Snapshotting a view (0x1050dae00, UIKeyboardImpl) that has not been rendered at least once requires afterScreenUpdates:YES.
@JohannesWarn JohannesWarn added the bug Something isn't working label Jun 24, 2024
@JohannesWarn
Copy link
Author

I first reported this issue on Slack: https://livekit-users.slack.com/archives/C01KVTJH6BX/p1718877778313319

@hiroshihorie
Copy link
Member

Yes, this is expected behavior but it's confusing. We are planning to change the behavior.

@JohannesWarn
Copy link
Author

JohannesWarn commented Jun 24, 2024

Ok. Is there any other way to currently observe the connection state of the user when reconnecting? The experience we able to build for the disconnected user now is that it seems everyone else has disconnected from the call.

And thank you for the quick response :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants