diff --git a/Source/SocketIO/Engine/SocketEngine.swift b/Source/SocketIO/Engine/SocketEngine.swift index a8899af..e11046c 100644 --- a/Source/SocketIO/Engine/SocketEngine.swift +++ b/Source/SocketIO/Engine/SocketEngine.swift @@ -263,7 +263,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll if forceWebsockets { polling = false websocket = true - createWebsocketAndConnect() + createWebSocketAndConnect() return } @@ -318,9 +318,9 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll return (urlPolling.url!, urlWebSocket.url!) } - private func createWebsocketAndConnect() { - ws?.delegate = nil - ws = WebSocket(url: urlWebSocketWithSid as URL) + private func createWebSocketAndConnect() { + ws?.delegate = nil // TODO this seems a bit defensive, is this really needed? + ws = WebSocket(url: urlWebSocketWithSid) if cookies != nil { let headers = HTTPCookie.requestHeaderFields(with: cookies!) @@ -475,7 +475,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll } if !forcePolling && !forceWebsockets && upgradeWs { - createWebsocketAndConnect() + createWebSocketAndConnect() } sendPing()