Combined websocket code into one request