moved websocket stuff out