wrote some chat server logic