Skip to content

SSE (text/event-stream) framing for event streams #3222

Description

@goelakash

What this is

A question about whether Smithy should be able to model event streams framed as Server-Sent Events (text/event-stream), and if so, how the trait should look. I've built a TypeScript prototype and want maintainer input on the design before it goes further.

What I can state

  • Smithy models event streams with @streaming unions. In the implementations I looked at (smithy-typescript and smithy-java), the on-the-wire framing is the binary application/vnd.amazon.eventstream encoding. I have not checked smithy-rust, smithy-python, or smithy-go, so I can't claim SSE is absent ecosystem-wide — please correct me if it exists somewhere.
  • In smithy-java, text/event-stream appears only inside the MCP proxy (HttpMcpProxy), not as a modeled protocol for @streaming unions — its rpcv2 event-stream path sets application/vnd.amazon.eventstream.
  • I could not find a way to model SSE framing in Smithy today. If there is one, this discussion is moot and I'd appreciate a pointer.

Prototype (TypeScript only)

I have a working prototype in smithy-typescript (PR smithy-lang/smithy-typescript#2177, tracking issue #2176): an SSE event-stream marshaller with the same interface contract as the binary one, plus an experimental sseJson protocol behind an opt-in flag. In TypeScript, the typed @streaming union and per-event serde were reusable unchanged — only the wire framing differed. I don't know whether that reuse holds in other languages.

Questions

  1. Is there existing support for SSE-framed event streams anywhere in Smithy that I've missed?
  2. If not, is this something Smithy wants — as a first-class protocol trait, or a framing modifier on existing HTTP protocols?
  3. Wire mapping: is event: = Smithy event-type name reasonable? How should modeled exceptions and the unmodeled/$unknown case be represented?
  4. Should this be designed in core so all languages stay consistent, or is a per-language protocol acceptable?

I'm not asserting SSE belongs in Smithy — I'm asking. Happy to adapt or drop the prototype based on the answer.


Earlier discussion thread on this topic: #3221.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions