Server-side code for a chatroom