UNPKG

xcube

Version:

Alipay Cube Tools

31 lines (30 loc) 1.04 kB
/// <reference types="node" /> import * as WS from 'ws'; import * as Http from 'http'; export declare type EventName = 'server-error' | 'server-listening' | 'server-connection' | 'client-error' | 'client-close'; export declare enum State { UNKNOWN = 0, INVALID = 1, LISTENING = 2 } export declare namespace Singleton { const IP: string; const PORT = 9001; const server: Http.Server; const wss: WS.Server; let receiveSocketMessage: any; let onEvent: (name: EventName, params: any) => void; let state: State; } export declare function launch(on?: (name: EventName, params: any) => void): Promise<void>; export declare function clientSessions(): any[]; export declare function broadcase(data: string): Promise<void>; export declare function send(token: string, data: string): Promise<void>; export declare function qrvalue(): string; export declare function fillFileRemoteUrl(filePath: string): string; export interface Session { token: string; name: string; os: string; platform: string; }