Proper WebSocket implementation