Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

resumeWebSocketResponse.md

48 lines978 Bytes

1---
2id: resumeWebSocketResponse
3title: resumeWebSocketResponse
4---
5​
6```ts
7function resumeWebSocketResponse<TOffset>(options): Response;
8```
9​
10Defined in: packages/ai/src/stream-to-websocket.ts:419
11​
12Cloudflare wrapper (Workers/Durable Objects): creates a `WebSocketPair`,
13accepts the server socket, delegates to [resumeWebSocketStream](resumeWebSocketStream.md), and
14returns the 101 upgrade `Response` carrying the client socket. Throws when
15the runtime has no `WebSocketPair` (Node, Deno, Bun) — upgrade the socket
16yourself and call [resumeWebSocketStream](resumeWebSocketStream.md) directly there.
17​
18## Type Parameters
19​
20### TOffset
21​
22`TOffset` *extends* `string` = `string`
23​
24## Parameters
25​
26### options
27​
28#### adapter
29​
30[`StreamDurability`](../interfaces/StreamDurability.md)\<`TOffset`\>
31​
32#### batch?
33​
34`number`
35​
36#### debug?
37​
38[`DebugOption`](../type-aliases/DebugOption.md)
39​
40## Returns
41​
42`Response`
43​
44## Example
45​
46```ts
47resumeWebSocketResponse({ adapter: memoryStream(request) })
48```