본문으로 건너뛰기

Interface: WebSocketLike

정의 위치: packages/ai/src/stream-to-websocket.ts:15

코어에 필요한 최소 WHATWG WebSocket 인터페이스입니다. Cloudflare WebSocketPair 서버 소켓, Deno의 업그레이드된 소켓, ws(Node) 소켓은 이미 이를 충족합니다. Bun의 ServerWebSocket(핸들러 객체 API)은 호출 지점에서 약 10줄의 어댑터를 추가하면 됩니다.

속성

addEventListener

addEventListener: {
(type, handler): void;
(type, handler): void;
};

정의 위치: packages/ai/src/stream-to-websocket.ts:18

호출 시그니처

(type, handler): void;
매개변수
type

"message"

handler

(ev) => void

반환값

void

호출 시그니처

(type, handler): void;
매개변수
type

"error" | "close"

handler

() => void

반환값

void


close

close: (code?, reason?) => void;

정의 위치: packages/ai/src/stream-to-websocket.ts:17

매개변수

code?

number

reason?

string

반환값

void


send

send: (data) => void;

정의 위치: packages/ai/src/stream-to-websocket.ts:16

매개변수

data

string

반환값

void