It starts as a regular HTTP request with an Upgrade: websocket header. The server confirms the upgrade — and the TCP connection remains open. Both sides can send messages at any time, with no overhead of a new HTTP request.
Node.js: Socket.io, ws. PHP: Ratchet, Swoole, ReactPHP. Go: gorilla/websocket. Python: websockets, FastAPI WebSocket. In production, a dedicated WebSocket server is often run alongside the main HTTP application.