simplify code removing unnecessary WebsocketConnection class