From bb15412675ddca93c3190f11c6dfc1de9c1672b5 Mon Sep 17 00:00:00 2001 From: "Glenn R. Fisher" Date: Fri, 19 Jan 2018 11:44:29 -0600 Subject: [PATCH 1/2] Update Starscream to v3.0.4 --- Cartfile.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 9a56f1ca032d2520a9b5214078d67f9b037aaac5 Mon Sep 17 00:00:00 2001 From: "Glenn R. Fisher" Date: Fri, 19 Jan 2018 11:51:11 -0600 Subject: [PATCH 2/2] Modify isNormalDisconnect for updated Starscream error handling --- Source/SpeechToTextV1/SpeechToTextSocket.swift | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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) {