Refactored websocket driver