Skip to content

createSSEResponse

createSSEResponse<T>(stream, options): Response

Defined in: react-nextjs/src/server.ts:99

Create a Server-Sent Events (SSE) response.

T

AsyncIterable<T>

Async iterable of data objects

StreamingResponseOptions = {}

Response options

Response

Web Response with SSE body

app/api/chat/route.ts
import { createSSEResponse } from 'ai.matey.react.nextjs/server';
export async function POST(request: Request) {
const stream = generateChatStream();
return createSSEResponse(stream);
}