You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/openapi-ts/clients/ofetch.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,6 +282,22 @@ client.setConfig({
282
282
});
283
283
```
284
284
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 =awaitclient.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
+
285
301
## Build URL
286
302
287
303
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