 import Foundation
 
 public class WebsocketsTransport: Transport {
+    private let transportQueue: DispatchQueue = DispatchQueue(label: "SignalR.webSocketTransport.queue")
+    private var isTransportClosed = false
+
     var webSocket:WebSocket? = nil
     public weak var delegate: TransportDelegate? = nil
 

            request.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
        }
    }
}

fileprivate enum WebSocketsTransportError: Error {

        }

        webSocket!.event.error = { error in
            // This handler should not be called after the close event but we need to mark the transport as closed to prevent calling transportDidClose
            // on the delegate multiple times so we can as well add the check and log
            guard !self.markTransportClosed() else {
                // TODO: add logging
                return
            }

            self.delegate?.transportDidClose(error)
        }

