Defjs
Core

WebSocketInterceptorFn

WebSocket interceptor function: may inspect, modify, or replace the request, then call next.

@defjs/core · Type

Signature

type WebSocketInterceptorFn = (
  req: HttpRequest,
  next: WebSocketHandler,
) => Promise<WebSocketSessionLike>;

Call next (a WebSocketHandler) to continue the chain, or return your own WebSocketSessionLike to short-circuit. Wrap it with createWebSocketInterceptor to register it through withInterceptors.

The chain runs once per operation. Reconnects happen inside the session it returns and do not run it again.

Parameters

Prop

Type

req HttpRequest
next WebSocketHandler
Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao