     private var socket: WebSocket!
     private var pingTimer: Timer!
     private var pongTimer: Timer!
+    private var commTimer: Timer!
     private var pendingRequests: Dictionary<RequestKey, Request> = [:]
     private var lastID: String? = nil
-    private var lastIDTime: DispatchTime? = nil
 
     var connectionDelegate = MulticastDelegate<WebSocketConnectionDelegate>()
     var communicationDelegate = MulticastDelegate<WebSocketCommunicationDelegate>()

    private static let pingInterval = 3.0
    private static let pongTimeout = 2.0
    private static let disconnectTimeout = 1.0

    private let readRequestType = "read"
    private let updateRequestType = "update"

        return randomString
    }

    private func sendRequest(requestType: String, resource: String, content: Serializible?) {
        let request = Request(id: getRandomID(), requestType: requestType, resource: resource, content: content)
        pendingRequests[RequestKey(requestType, resource)] = request
        sendFromPending();
    }
    
    private func sendFromPending() {
        if self.lastID == nil {
            if let request = pendingRequests.first {
                _ = sendRequest(request: request.value)
            }
        }
    }

    private func sendRequest(request: Request) {
        self.lastID = request.id
        switch self.serializer.serializeToString(request) {
        case let .Value(json):
            socket.write(string: json)
        case .Error:
            return
        }
        self.commTimer = Timer.scheduledTimer(timeInterval: WebSocketClient.responseTime, target: self, selector: #selector(self.noResponse), userInfo: nil, repeats: false)
    }
    
    func noResponse() {
        print("no response, resending...")
        self.lastID = nil
        sendFromPending()
    }
    
    func coolingEnd() {
        _ = pendingRequests.popFirst()
        self.lastID = nil
        sendFromPending()
    }
}
