     private var fastUpgrade = false
     private var forcePolling = false
     private var forceWebsockets = false
-    private var gotPong = true
+    private var pingInterval:Int?
     private var pingTimer:NSTimer?
+    private var pingTimeout = 0
+    private var pongsMissed = 0
+    private var pongsMissedMax:Int {
+        return pingTimeout / (pingInterval ?? 25)
+    }
     private var postWait = [String]()
     private var _polling = true
     private var probing = false

    weak var client:SocketEngineClient?
    var cookies:[NSHTTPCookie]?
    var log = false
    var pingInterval:Int?
    var polling:Bool {
        return _polling
    }

                    createWebsocket(andConnect: true)
                }
                
                if let pingInterval = json["pingInterval"] as? Int, pingTimeout = json["pingTimeout"] as? Int {
                    self.pingInterval = pingInterval / 1000
                    self.pingTimeout = pingTimeout / 1000
                }
        } else {
            client?.didError("Engine failed to handshake")
