Replacing WebSocket logic with simple TCP communication
Small changes to make TCP connection more resilient