implement the basic function of the chatroom.