Promptles
Backend & APIs

WebSocket

advanced

Definition

An always-open connection between an app and a server, where either side can send messages to the other at any moment. Normal web requests are like exchanging letters one at a time; a WebSocket is like leaving the phone line open so you can talk back and forth instantly.

In the wild

In a live chat app, the moment a friend sends you a message, it appears on your screen: no refresh needed. That's a WebSocket at work: the server pushes the new message down the open connection the instant it arrives.

More from Backend & APIs