Add WebSocket and Server-Sent Events (SSE) client effects.
Motivation
Streaming LLM responses (OpenAI, Anthropic, and other inference APIs) use SSE. Real-time applications need WebSocket connections. These are distinct from the request/response model of the Http effect.
Proposed effects
-- SSE: server-sent event stream
fn stream_completion(@String -> @Unit)
effects(<SSE, IO>)
{
SSE.connect(@String.0, fn(@String -> @Unit) effects(<IO>) {
IO.print(@String.0)
})
}
SSE.connect(url, handler) — open an SSE connection, call handler for each event
WebSocket.connect(url) — open a WebSocket connection
WebSocket.send(message) / WebSocket.receive() — bidirectional messaging
Dependencies
Add WebSocket and Server-Sent Events (SSE) client effects.
Motivation
Streaming LLM responses (OpenAI, Anthropic, and other inference APIs) use SSE. Real-time applications need WebSocket connections. These are distinct from the request/response model of the Http effect.
Proposed effects
SSE.connect(url, handler)— open an SSE connection, call handler for each eventWebSocket.connect(url)— open a WebSocket connectionWebSocket.send(message)/WebSocket.receive()— bidirectional messagingDependencies