<!-- description: Server-Sent Events (SSE) is a web technology that enables a server to push real-time updates to a client over a persistent HTTP connection, used by AgentRQ to deliver agent notifications instantly. -->

# SSE (Server-Sent Events)

**Server-Sent Events (SSE)** is a web technology that enables a server to push real-time, one-directional updates to a client over a persistent HTTP connection. Unlike traditional HTTP where the client must poll for updates, SSE maintains an open connection through which the server can stream data as it becomes available.

## How SSE Works

```
Client                          Server
  │                               │
  │── GET /events (EventSource) ──▶│
  │                               │
  │◀── data: {"type":"task"} ─────│  (immediate push)
  │                               │
  │◀── data: {"type":"message"} ──│  (seconds later)
  │                               │
  │       [connection stays open] │
```

1. The client opens a persistent HTTP connection to the server's SSE endpoint
2. The server sends events as they occur — no polling required
3. The connection auto-reconnects if dropped

## SSE vs. WebSockets vs. Polling

| Method | Direction | Protocol | Use Case |
|--------|-----------|----------|----------|
| Polling | Client pulls | HTTP | Simple, high-latency OK |
| SSE | Server pushes | HTTP | Real-time server-to-client |
| WebSockets | Bidirectional | WS | Full-duplex real-time |

SSE is simpler than WebSockets and works over standard HTTP/2 — making it ideal for server-to-agent event streaming.

## SSE in MCP

The [Model Context Protocol](mcp) supports SSE as one of its transport options. When an [MCP server](mcp-server) like AgentRQ is accessed remotely, it uses HTTP for tool calls and SSE for streaming responses and real-time events.

## SSE in AgentRQ

AgentRQ uses SSE to deliver real-time [notifications](notification) and messages to connected clients. When a [Claude Code](claude-code) agent calls the `reply` [MCP tool](mcp-tool), AgentRQ pushes the message to your [task board](task-board) via SSE — appearing instantly without any refresh or polling on your end.

## Related Terms

- [MCP](mcp)
- [MCP Server](mcp-server)
- [Notification](notification)
- [Channel](channel)
- [Task Board](task-board)
