Refactor Out Websocket send_data Logic