refactor javascript websocket, fix movement origin.