adding chat server logic