diff --git a/Cartfile.resolved b/Cartfile.resolved index 62b4094eb..0bff47419 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "daltoniam/Starscream" "3.0.3" +github "daltoniam/Starscream" "3.0.4" github "daltoniam/common-crypto-spm" "1.1.0" github "daltoniam/zlib-spm" "1.1.0" diff --git a/Source/SpeechToTextV1/SpeechToTextSocket.swift b/Source/SpeechToTextV1/SpeechToTextSocket.swift index 0522c9b84..9fffee5dc 100644 --- a/Source/SpeechToTextV1/SpeechToTextSocket.swift +++ b/Source/SpeechToTextV1/SpeechToTextSocket.swift @@ -209,13 +209,8 @@ internal class SpeechToTextSocket: WebSocketDelegate { } private func isNormalDisconnect(error: Error) -> Bool { - let error = error as NSError - let matchesDomain = (error.domain == "WebSocket") - let matchesCode = (error.code == 1000) - if matchesDomain && matchesCode { - return true - } - return false + guard let error = error as? WSError else { return false } + return error.code == Int(CloseCode.normal.rawValue) } internal func websocketDidConnect(socket: WebSocketClient) {