     
     private func upgradeTransport() {
         if self.websocketConnected {
+            self._websocket = true
+            self._polling = false
             self.ws?.send(PacketType.UPGRADE.rawValue)
         }
     }

                self.ws?.send(msg)
            }
        } else {
            // TODO handle polling
        }
    }
    
    func sendPing() {
        if self.websocketConnected {
            self.ws?.send(PacketType.PING.rawValue)
        }
    }
    
    // Starts the ping timer

            return
        }
        
        self.pingTimer?.invalidate()
        dispatch_async(dispatch_get_main_queue()) {
            self.pingTimer = NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(self.pingInterval!), target: self,
                selector: Selector("sendPing"), userInfo: nil, repeats: true)
