         }
         
         //Get the 50 past messages to fill the tableview
-        //This is just temporary. Later the RoomHistoryManager will handle the way the messages are coming in
         let now = NSDate()
         
         let formData = NSDictionary(dictionary: [

                
                
                
//                                print(self.chatMessages)
                //                print(self.chatMessageData!)
                
                
                var i = self.chatMessages.count
                
                for (_,subJson) in self.chatMessages {

                        type = subJson["t"].string!
                    }
                    
                    let timestamp = [subJson["ts","$date"].number!]
                    let timestampInDouble = timestamp as! [Double]
                    let timestampInMilliseconds = timestampInDouble[0] / 1000
                    
                    let  cM = ChatMessage(user_id: subJson["u","_id"].string!, username: subJson["u","username"].string!, msg: subJson["msg"].string!, msgType: type, ts: timestampInMilliseconds)
                    
                    
                    self.chatMessageData[i] = cM

                    i--
                }
                
                
                //Reload data and scroll to the bottom of the tableview
