Converting ajax calls to websocket calls. WIP