Not every API waits for you to ask. Chat apps, live dashboards and IoT devices push data as it happens. Hoppscotch’s Realtime section can open and hold these connections, send messages and log everything that comes back. It supports four protocols.
Which protocol is which?
| Protocol | Direction | Typical use |
|---|---|---|
| WebSocket | Both ways | Chat, multiplayer, live collaboration |
| Server-Sent Events (SSE) | Server to client only | Notifications, live feeds, progress updates, AI text streaming |
| Socket.IO | Both ways, event-based | Node.js apps using the Socket.IO library |
| MQTT | Publish/subscribe through a broker | IoT sensors and devices, messaging between services |
WebSocket
- Open Realtime → WebSocket.
- Enter a server address starting with
wss://(secure) orws://. For practice, the echo server suggested by Hoppscotch — or the publicwss://echo.websocket.org— sends back whatever you send. - Click Connect. The log shows when the connection opens.
- Type a message (plain text or JSON) and send it. With an echo server, the same message appears in the log as received.
If the server needs a sub-protocol, add it in the protocols field before connecting. Click Disconnect when you’re done so the server can clean up.
Server-Sent Events
SSE uses a normal HTTP connection that the server keeps open, sending events as lines of text.
- Open Realtime → SSE.
- Enter the URL of an endpoint that returns
text/event-stream. - Optionally set the event type to listen for (the default is
message). - Start the connection and watch events appear in the log.
If nothing arrives, check in the REST screen that the endpoint really responds with the text/event-stream content type.
Socket.IO
Socket.IO adds its own handshake and an event system on top of WebSocket, so a plain WebSocket client can’t talk to it — use the dedicated screen.
- Open Realtime → Socket.IO and enter your server URL.
- Pick the client version matching your server (Socket.IO versions are not fully compatible with each other).
- If your server uses a custom path instead of
/socket.io, set it. - Connect, then emit an event: give it a name such as
chat:messageand a JSON payload. - Events the server emits back are listed in the log.
MQTT
MQTT clients don’t talk to each other directly. They connect to a broker, subscribe to topics and publish messages to topics.
- Open Realtime → MQTT.
- Enter a broker URL that supports MQTT over WebSockets. The public test broker run by the Eclipse Mosquitto project,
wss://test.mosquitto.org:8081, is handy for experiments. - Connect, then subscribe to a topic with a unique name, for example
yourname/test/temperature. - Publish a message such as
{"celsius": 21.5}to the same topic. It appears in your subscription log.
Public test brokers are visible to everyone. Never send real data or credentials to them, and use unusual topic names so you don’t collide with other people’s tests.
Tips for realtime testing
- Use the desktop app for servers on
localhostor inside a private network. - Watch for silent disconnects: many servers close idle connections after a timeout.
- Keep the message log open while you trigger actions in your app — it’s a quick way to see exactly what the server pushes.