     func closeSocket() {
         fileLog.debug("closed streams.")
         
+        self.stopPingTimer()
+
         self.inputStream?.delegate = nil
         self.outputStream?.delegate = nil
         

    
    var inputStream: NSInputStream?
    var outputStream: NSOutputStream?
    
    var parsingString: NSString = ""
    

        
        return chatResults
    }

    // MARK: - Private Functions
    func startPingTimer() {
        self.pingTimer = NSTimer.scheduledTimerWithTimeInterval(
            60, target: self, selector: Selector("sendPing:"), userInfo: nil, repeats: true)
    }

    func stopPingTimer() {
        self.pingTimer?.invalidate()
        self.pingTimer = nil
    }

    func sendPing(timer: NSTimer) {
        sendMessage("<ping>PING</ping>")
    }
}
