---
title: "Live connections · Agent Wranglers"
url: https://agentwranglers.se/playbook/api-design/live-connections
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Live connections

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [API design](https://agentwranglers.se/playbook/api-design.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

> Pick polling, server-sent events or WebSockets by need, check access for the whole connection, cap each client and deliver from any server.

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/api-design/live-connections">Agent Wranglers API design playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- API-70 [Check access when the connection opens and while it lasts](https://agentwranglers.se/playbook/api-design/live-connections/connection-access): Sign the client in during the handshake, as for any request. Check permission for each channel it joins and each message it sends. Close the connection when its session ends.
- API-73 [Limit the connections and messages of each client](https://agentwranglers.se/playbook/api-design/live-connections/connection-limits): Limit how many connections each account may hold open, how large one message may be and how many messages it may send per minute. Close or refuse the rest.

## Recommended

- API-69 [Choose the transport that the feature needs](https://agentwranglers.se/playbook/api-design/live-connections/choose-transport): Poll when a delay of 30 seconds or more is fine. Use server-sent events when only the server sends. Use WebSockets only when the client also sends a stream of messages.
- API-71 [Send heartbeats and drop dead connections](https://agentwranglers.se/playbook/api-design/live-connections/heartbeats): Send a ping on every quiet WebSocket every 30 seconds, and close a connection that misses two pongs in a row.
- API-72 [Reconnect with backoff and resume from the last event](https://agentwranglers.se/playbook/api-design/live-connections/reconnect-and-resume): Clients wait a random time before the first reconnect and longer after each failure. They resume from the last event ID they saw, so nothing is lost or shown twice.
- API-74 [Deliver events through a shared channel](https://agentwranglers.se/playbook/api-design/live-connections/shared-pubsub): When more than one server holds connections, publish every event to a shared channel. Each server then delivers it to the clients connected to it.

- Previous: [Files and uploads](https://agentwranglers.se/playbook/api-design/files-and-uploads)
- Next: [Using other companies' APIs](https://agentwranglers.se/playbook/api-design/using-other-companies-apis)
- [All chapters](https://agentwranglers.se/playbook/api-design)
