Closed wzJun1 closed 6 months ago
The same problem occurs when using livekit cloud
Version: 1.0.13
no such problem
urgent! urgent!
I printed the websocket message and found that the join
message was delayed.
Hello, can I have the exact SDK version ?
Hello, can I have the exact SDK version ?
Latest, direct git clone
I don't understand what caused it, but when printing the websocket message, I found that when the connection is success, I will receive the join first. Once there are problems or abnormal connection, you will receive an offer or refreshToken first. I'm not sure if it will be helpful for your verification.
It can be confirmed that the old version does not have this issue
Ok you are on the latest main
, that sounds like something wrong with the response queue. I will investigate.
Ok you are on the latest
main
, that sounds like something wrong with the response queue. I will investigate.
Thank you for your reply! Hope you can check!
I think this will fix it: https://github.com/livekit/client-sdk-swift/pull/306
Okay, I will try it.
thx! The connection is normal!
But my IDE doesn’t seem to support the following writing method, so I modified it.
func _onWebSocketMessage(message: URLSessionWebSocketTask.Message) {
// var response: Livekit_SignalResponse? = if case let .data(data) = message {
// try? Livekit_SignalResponse(contiguousBytes: data)
// } else if case let .string(string) = message {
// try? Livekit_SignalResponse(jsonString: string)
// } else {
// nil
// }
var response: Livekit_SignalResponse? = nil
if case let .data(data) = message {
response = try? Livekit_SignalResponse(contiguousBytes: data)
} else if case let .string(string) = message {
response = try? Livekit_SignalResponse(jsonString: string)
} else {
response = nil
}
guard let response else {
log("Failed to decode SignalResponse", .warning)
return
}
Task {
var isJoinOrReconnect = false
switch response.message {
case .join, .reconnect: isJoinOrReconnect = true
default: false
}
// Always process join or reconnect messages even if suspended...
await _responseQueue.processIfResumed(response, or: isJoinOrReconnect)
}
}
Xcode 14.2 compiling has been fixed, and now it's merged in main
branch.
Thanks for the detailed report !
Describe the bug
when someone has created a room and there is someone in the room, and the iOS client using the iOS SDK is used to enter, occasionally the room cannot be connected and the following log appears.
Additional explanation: This may appear when the App is run for the first time (when there is no process of the App), but it does not appear the second, third and subsequent times.
SDK Version client sdk:latest version livekit server:1.5.2
Expected behavior normal connection, because everything works fine on Android (v1.6.0)
Logs xcode debug output:
iOS Room Options
LiveKitServer Config
TestConnection![test.png](https://s2.loli.net/2024/01/14/h3ZTF4ziO6Rta8y.png)