AIDK API Reference / aidk-express / withTransport
Function: withTransport() ​
ts
function withTransport(config: TransportConfig): (req: Request, res: Response, next: NextFunction) => Promise<void>;Defined in: packages/express/src/middleware/engine.ts:198
Creates middleware that joins the SSE connection to appropriate rooms. Must be used after withEngine middleware.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
config | TransportConfig | Transport configuration |
Returns ​
Express middleware
ts
(
req: Request,
res: Response,
next: NextFunction): Promise<void>;Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
next | NextFunction |
Returns ​
Promise<void>
Example ​
typescript
app.use(withEngine({ engine }));
app.use(withTransport({ transport: getSSETransport() }));
// Custom room pattern:
app.use(withTransport({
transport,
roomPattern: (ctx) => `org:${ctx.tenantId}:thread:${ctx.threadId}`,
}));