WebSocket

Protokół czasu rzeczywistego.

Treść oczekuje na tłumaczenie. Wyświetlana jest wersja angielska.

Unlike HTTP, which is request-response based, WebSocket allows for persistent, two-way communication between server and client. This is essential for real-time applications like chat, gaming, and financial dashboards (trading bots).

        graph LR
  Center["WebSocket"]:::main
  Rel_http["http"]:::related -.-> Center
  click Rel_http "/terms/http"
  Rel_tcp_ip["tcp-ip"]:::related -.-> Center
  click Rel_tcp_ip "/terms/tcp-ip"
  Rel_sockets["sockets"]:::related -.-> Center
  click Rel_sockets "/terms/sockets"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 Sprawdzenie wiedzy

1 / 1

🧒 Wyjaśnij jak 5-latkowi

A 'hotline' between a web browser and a server. Instead of asking 'is there new mail?' ([HTTP](/pl/terms/http)), the server can just shout 'HEY, NEW MAIL!' the moment it arrives.

🤓 Expert Deep Dive

Starts as an HTTP handshake with an 'Upgrade' header. Once established, it is a binary or text stream. Reduces overhead by eliminating header repetition on every message.

📚 Źródła