cyl-hooks-tools
Version:
基于react上下文实现的权限管理
10 lines (5 loc) • 400 B
TypeScript
export function useWebsocket<T>(id: string, url: string,
callback: (id: string, ws: WebSocket, eventName: 'open' | 'close' | 'message' | 'error',
eventData: any, data: T) => void, deps: unknown[]): void
export function makeWebsocketUrlFromRelativeUrl(relurl?: string): string
export function makeWebsocketUrl(protocol: "https" | "http", host: string, relurl?: string): string