UNPKG

partysocket

Version:
63 lines (61 loc) 1.7 kB
import { i as Options, o as ReconnectingWebSocket } from "./ws-DKArEqfS.js"; //#region src/index.d.ts type Maybe<T> = T | null | undefined; type Params = Record<string, Maybe<string>>; type PartySocketOptions = Omit<Options, "constructor"> & { id?: string; host: string; room?: string; party?: string; basePath?: string; prefix?: string; protocol?: "ws" | "wss"; protocols?: string[]; path?: string; query?: Params | (() => Params | Promise<Params>); disableNameValidation?: boolean; }; type PartyFetchOptions = { host: string; room: string; party?: string; basePath?: string; prefix?: string; path?: string; protocol?: "http" | "https"; query?: Params | (() => Params | Promise<Params>); fetch?: typeof fetch; }; declare class PartySocket extends ReconnectingWebSocket { readonly partySocketOptions: PartySocketOptions; _pk: string; _pkurl: string; name: string; room?: string; host: string; path: string; basePath?: string; constructor(partySocketOptions: PartySocketOptions); updateProperties(partySocketOptions: Partial<PartySocketOptions>): void; private setWSProperties; reconnect(code?: number | undefined, reason?: string | undefined): void; get id(): string; /** * Exposes the static PartyKit room URL without applying query parameters. * To access the currently connected WebSocket url, use PartySocket#url. */ get roomUrl(): string; static fetch( options: PartyFetchOptions, init?: RequestInit ): Promise<Response>; } //#endregion export { PartyFetchOptions, PartySocket, PartySocket as default, PartySocketOptions, ReconnectingWebSocket as WebSocket }; //# sourceMappingURL=index.d.ts.map