         self.pingTimer?.invalidate()
         self.pollingTimer?.invalidate()
         
-        if websocketConnected {
+        if self.websocket {
             self.ws?.send(PacketType.MESSAGE.rawValue + PacketType.CLOSE.rawValue)
             self.ws?.close()
+        } else {
+            // TODO handling polling
         }
     }
     

        }
    }
    
    func handlePollingResponse(str:String) {
        // TODO add polling
    }
    
    func parseWebSocketMessage(message:AnyObject?) {
        if let data = message as? NSData {
            // Strip off message type
            self.client.parseSocketMessage(data.subdataWithRange(NSMakeRange(1, data.length - 1)))

    func webSocket(webSocket:SRWebSocket!, didReceiveMessage message:AnyObject?) {
        // println(message)
        
        self.parseEngineMessage(message)
    }
    
    // Called when the socket is opened
