| type | skill |
| lifecycle | stable |
| inheritance | inheritable |
| name | sse-streaming |
| description | POST-based Server-Sent Events streaming for Azure Functions — HTTP streaming, chunked response parsing, reconnection |
| tier | extended |
| applyTo | **/*sse*,**/*streaming*,**/*server-sent*,**/*real-time* |
| metadata | {"version":"1.0.0","category":"web-development","tags":["sse","streaming","azure-functions","http-streaming","readablestream","real-time"],"activation":{"triggers":["SSE","streaming","server-sent events","HTTP streaming","ReadableStream","chunked response","real-time"],"context":"Working on real-time streaming from Azure Functions to client"},"prerequisites":[]} |
| currency | 2026-04-22T00:00:00.000Z |
SSE Streaming
POST-based Server-Sent Events pattern for Azure Functions. Solves the gap where native EventSource (GET-only) can't send request bodies, and Azure Static Web Apps don't proxy WebSocket to the API layer.
Why POST-Based SSE
| Option | SWA API Support? | POST body? | Limitation |
|---|
| WebSocket | No | N/A | SWA doesn't proxy WebSocket to Functions |
| EventSource | Yes | GET only | Can't send context in request body |
| POST + ReadableStream | Yes | Yes | Recommended pattern |
Azure Functions Setup
Enable HTTP Streaming
{
"version": "2.0",
"extensions": {
"http": {
"enableHttpStream": true
}
}
}
Streaming Function Pattern
import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';
app.http('stream-response', {
methods: ['POST'],
authLevel: 'anonymous',
: ,
: (: , : ): <> => {
payload = req.();
stream = ({
() {
{
aiStream = (payload);
( chunk aiStream) {
sseData = ;
controller.( ().(sseData));
}
controller.(
().()
);
} (error) {
controller.(
().()
);
} {
controller.();
}
},
});
{
: ,
: {
: ,
: ,
: ,
: ,
},
: stream,
};
},
});