OpenAI Responses WebSocket Lane (responses/responses-websocket-lane.ts)

openai-node · src/lib/responses/responses-websocket-lane.ts · typescript · Apache-2.0
integration, realtime, ai

Manages real-time WebSocket communication and event handling for OpenAI API response streams.

// Source: https://github.com/openai/openai-node | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import type {
  Response,
  ResponsesClientEvent,
  ResponsesServerEvent,
} from '../../resources/responses/responses';
import { WebSocketError } from '../../resources/responses/internal-base';
import { OpenAIError } from '../../core/error';
import { hasOwn, isObj } from '../../internal/utils/values';
import {
  cloneResponse,
  createCanonicalResponseContext,
  ensureCanonicalOutputText,
} from '../../internal/responses/canonical-output-text';

type WireResponse = Omit<Response, 'output' | 'output_text'> &
  Partial<Pick<Response, 'output' | 'output_text'>>;

type WireEvent<Event> = E

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key