0Pricing
MCP Academy · Aula

Transmitir respostas com SSE

Envie resultados incrementais de volta pelo fluxo.

Transmitir respostas com SSE é uma aula grátis de MCP Academy no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de MCP Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de MCP Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Why Stream at All?

Some tools take time: a long search or a slow API call. Instead of making the client wait in silence, the server can stream updates as they happen. ⏳

Meet SSE

Streamable HTTP streams using Server-Sent Events, or SSE. It is a simple, web-native way for a server to push a sequence of messages over one open connection.

One Direction Only

SSE flows in a single direction: server to client. The server keeps the connection open and pushes events down it whenever it has something new to say.

The Telltale Content Type

You know a reply is a stream by its Content-Type. When the server sets it to text/event-stream, the client reads events instead of one final body.

Content-Type: text/event-stream

What an Event Looks Like

Each SSE event is just text. Lines starting with data: carry the payload, and a blank line marks the end of one event before the next begins.

data: {"jsonrpc":"2.0","id":1,"result":{}}

Events Carry JSON-RPC

Inside each event sits a familiar JSON-RPC message. Streaming does not invent a new format; it just delivers the same messages over time.

Progress While You Wait

A streaming reply can send progress notifications first, then the final result last. The user sees the tool is working instead of staring at a spinner.

Quick Calls Skip the Stream

Streaming is optional. For a fast tool, the server can just return a single JSON response and close, with no event stream needed at all.

Each Event Can Be Numbered

SSE lets the server tag events with an id. That tiny detail becomes important later: it is how a client can resume a stream after a dropped connection.

id: 42
data: {...}

The SDK Handles the Plumbing

You rarely write raw SSE by hand. The MCP SDK formats events for you; you simply send progress and results, and it streams them correctly.

Better Feel, Same Result

Streaming does not change what a tool returns, only how it feels. The final answer is identical; the user just gets a smoother, more responsive experience. ✨

Quick Check

How does a server signal that a reply is a live stream?

Recap: Streaming with SSE

SSE lets the server push JSON-RPC events down one open connection: progress first, result last. It is optional, web-native, and makes slow tools feel fast. 🎉

Perguntas Frequentes

A aula “Transmitir respostas com SSE” é grátis?

Sim — o texto completo de “Transmitir respostas com SSE” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de MCP Academy, atualize para CoddyKit PRO. O curso de MCP Academy inclui 4 aulas no total.

O que vou aprender em “Transmitir respostas com SSE”?

Envie resultados incrementais de volta pelo fluxo. Você pratica MCP Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar MCP Academy?

Nenhuma experiência prévia é necessária. MCP Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.

Quanto tempo leva a aula “Transmitir respostas com SSE”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de MCP Academy?

Sim. Cada aula de MCP Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Por que stdio não é suficiente
  2. O transporte HTTP com transmissão
  3. Transmitir respostas com SSE
  4. Sessões e reconexão
← Voltar para MCP Academy