Modified client-side chat code to use websocket