Skip to main content

Module: agent-sse-echo-server

Functions

serveEchoAgentDev

serveEchoAgentDev(port, host?, path?): Promise<void>

serveDev provides an express handler that will echo the agent input back as a server-side events stream. This route is compatible with the agent-sse library. This route requires the express.json() (or similar) middleware to ensure that the JSON request body is parsed into an object. Use this if you want to run an echo server on an existing Express app.

Example

await serveDev(3001, 'localhost', '/api/chat');

Parameters

NameTypeDescription
portnumberPort to run the Express app on
host?stringHost to run the Express app on (usually localhost, 127.0.0.1, or 0.0.0.0)
path?stringPath to run the echoHandler on

Returns

Promise<void>

Defined in

packages/convostack-agent-sse-echo-server/dist/index.d.ts:31


sseEchoHandler

sseEchoHandler(req, res): void

echoHandler provides an express handler that will echo the agent input back as a server-side events stream. This route is compatible with the agent-sse library. This route requires the express.json() (or similar) middleware to ensure that the JSON request body is parsed into an object. Use this if you want to run an echo server on an existing Express app.

Example

app.post('/api/chat', express.json(), echoHandler);

Parameters

NameTypeDescription
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>Express Request
resResponse<any, Record<string, any>>Express Response

Returns

void

Defined in

packages/convostack-agent-sse-echo-server/dist/index.d.ts:16