moving websocket code back to machines.js for now