From 36894259c3c4a24206e91b5fa8e55280be9312e4 Mon Sep 17 00:00:00 2001 From: Malcolm Jarvis Date: Thu, 14 Sep 2017 15:30:09 -0700 Subject: [PATCH] Fix close error dispatching on incorrect queue `self.event.error` was being dispatched on the websocket's queue, when it should be dispatched on the queue specified by the library user. Wrapping this in a `fire { }` call like other events resolves the issue by correctly using the specified queue. --- Source/WebSocket.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/WebSocket.swift b/Source/WebSocket.swift index 3759966..905c9b3 100644 --- a/Source/WebSocket.swift +++ b/Source/WebSocket.swift @@ -759,8 +759,10 @@ private class InnerWebSocket: Hashable { } case .closeConn: if let error = finalError { - self.event.error(error) - self.eventDelegate?.webSocketError(error as NSError) + fire { + self.event.error(error) + self.eventDelegate?.webSocketError(error as NSError) + } } privateReadyState = .closed if rd != nil {