H
Web & Technology

WebSocket (ويب سوكت)

WebSocket is a protocol that opens a persistent, two-way connection between a browser and a server. Unlike normal requests, the connection stays open so both sides can send data instantly — powering chat, live notifications, and real-time dashboards.

In Iraqi dialect

اتصال مفتوح يخلي البيانات توصل لحالها بدون ما تعيد تحميل

In detail

HTTP is request-response: the client asks, the server answers, and the connection closes. For real-time features that wastes time and resources. A WebSocket handshake upgrades the connection so messages can flow in both directions at any moment. This is what makes live chat, collaborative editing, trading tickers, and multiplayer games possible with low latency. Servers keep track of connected clients and broadcast updates as events happen. Alternatives like Server-Sent Events offer one-way streaming with simpler setup. For interactive, bidirectional, real-time experiences, WebSockets remain the standard.

Practical example

A support chat shows agent replies instantly over a WebSocket without the page ever refreshing.

Frequently asked questions

Why use WebSocket instead of HTTP?

WebSocket keeps a live two-way connection open, enabling instant server-to-client pushes without repeated requests.

What is WebSocket commonly used for?

Chat, live notifications, collaborative tools, real-time analytics dashboards, and multiplayer interactions.

Related terms

Related services