Files
SnowLuma/.pnpm-store/v11/files/6a/46bdfff89a24d6fa94262fbe121a488989a577d4ab65d9f52ed7a7947a8bde2163e69f25b08ed479fd9cbbe0aae67321f0ef8d9f3d42fb018be5d22e06382e
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

55 lines
1.9 KiB
Plaintext

import { UpgradeWebSocket, WSContext, WSEvents } from "../../helper/websocket/index.js";
//#region src/adapter/bun/websocket.d.ts
/**
* @internal
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export interface BunServerWebSocket<T> {
send(data: string | ArrayBuffer | Uint8Array, compress?: boolean): void;
close(code?: number, reason?: string): void;
data: T;
readyState: 0 | 1 | 2 | 3;
}
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export interface BunWebSocketHandler<T> {
open(ws: BunServerWebSocket<T>): void;
close(ws: BunServerWebSocket<T>, code?: number, reason?: string): void;
message(ws: BunServerWebSocket<T>, message: string | {
buffer: ArrayBufferLike;
}): void;
}
interface CreateWebSocket<T> {
upgradeWebSocket: UpgradeWebSocket<T>;
websocket: BunWebSocketHandler<BunWebSocketData>;
}
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export interface BunWebSocketData {
events: WSEvents;
url: URL;
protocol: string;
}
/**
* @internal
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export declare const createWSContext: (ws: BunServerWebSocket<BunWebSocketData>) => WSContext;
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export declare const upgradeWebSocket: UpgradeWebSocket<any>;
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export declare const websocket: BunWebSocketHandler<BunWebSocketData>;
/**
* @deprecated Import `upgradeWebSocket` and `websocket` directly from `hono/bun` instead.
* @returns A function to create a Bun WebSocket handler.
*/
export declare const createBunWebSocket: <T>() => CreateWebSocket<T>;
//#endregion
export {};