                     createWebsocket(andConnect: true)
                 }
                 
-                if let pingInterval = json["pingInterval"] as? Int {
+                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")

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

        }
    }
    
    @objc private func sendPing() {
        //Server is not responding
        if pongsMissed > pongsMissedMax {
            pingTimer?.invalidate()
            client?.engineDidClose("Ping timeout")
            return
        }
        
        ++pongsMissed
        write("", withType: PacketType.PING, withData: nil)
    }
    
