Working implementation of WebSocket communication