encapsulate the websocket in a new class