 		wsRetries = 0
 		DispatchQueue.global().async {
 			sleep(5)	//asyncAfter doesn't seem to work on Linux
-			if !self.recievedMessage {
+			if self.lastEvent == nil {
 				self.ws.disconnect()
+				return
+			}
+			
+			while true {
+				sleep(600)
+				if Date().timeIntervalSinceReferenceDate - self.lastEvent!.timeIntervalSince1970 > 600 {
+					self.ws.disconnect()
+					return
+				}
 			}
 		}
 	}
 	
 	private func webSocketMessageText(_ text: String) {
-		recievedMessage = true
+		lastEvent = Date()
 		do {
 			guard let json = try client.parseJSON(text) as? [String:Any] else {
 				throw EventError.jsonParsingFailed(json: text)

///A ChatRoom represents a Stack Exchange chat room.
open class ChatRoom: NSObject {
	//MARK: - Instance variables
	let queue: DispatchQueue
	
	///A type of event from the chat room.
	public enum ChatEvent: Int {

				//look up the user instead of getting their name to make sure they're in the DB
				let user = userWithID(userID)
				
				print("\(roomID): \(user): \(content)")
				
				let message = ChatMessage(room: self, user: user, content: content, id: messageID, replyID: replyID)
				messageHandler(message, type == .messageEdited)
