First Steps: Refactoring websocket connection