Skip to content

Commit d709fe1

Browse files
committed
docs(ofetch): init SSE section
1 parent 5d521b1 commit d709fe1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/openapi-ts/clients/ofetch.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,22 @@ client.setConfig({
282282
});
283283
```
284284

285+
## SSE
286+
287+
The ofetch client supports Server‑Sent Events (SSE) via `client.sse.<method>`. Use this for streaming endpoints.
288+
289+
```ts
290+
const result = await client.sse.get({
291+
url: '/events',
292+
onSseEvent(event) {
293+
// event.data (string) or parsed data, depending on server
294+
},
295+
onSseError(error) {
296+
// handle stream errors
297+
},
298+
});
299+
```
300+
285301
## Build URL
286302

287303
If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint.

0 commit comments

Comments
 (0)