implements chat using websocket server