AxiomCore
Acore Language

Streaming and WebSockets

Contract types for HTTP streams, server-sent events, WebSockets, and files.

Attach one StreamingDef subtype to an endpoint.

HTTP and server-sent streams

streaming = HttpStreamDef {
  responseType = Models.Event
  framing = "event"
  encoding = "json"
}

HttpStreamDef supports framing values chunk, event, message, or file and encoding values json, text, or binary. SseStreamDef declares an SSE response type with its fixed sse kind.

WebSockets

streaming = WebSocketDef {
  direction = "bidirectional"
  reconnect = "auto"
  client = WsMessageDef { model = Models.ChatMessage }
  server = WsMessageDef { model = Models.ChatResponse }
}

Directions are server_to_client and bidirectional. Reconnect intent is auto, manual, or none. Client/server message values are singular WsMessageDef objects, not lists.

File streams

streaming = FileStreamDef {
  contentType = "application/pdf"
  filename = "report.pdf"
  disposition = "attachment"
}

Disposition is attachment or inline.

On this page