initial commit
This commit is contained in:
26
types/wssocket.d.ts
vendored
Normal file
26
types/wssocket.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface WsEvent {
|
||||
data: string;
|
||||
}
|
||||
export type OnOpenHandler = (this: WebSocket, ev: Event) => void;
|
||||
export type WsHandler = (ev: WsEvent, ws?: WebSocket) => void;
|
||||
interface SegmentData {
|
||||
action: 'sendSeg';
|
||||
cid: string;
|
||||
data: string;
|
||||
}
|
||||
export declare class WsSocket {
|
||||
private handlerList;
|
||||
private toSend;
|
||||
private isSending;
|
||||
private sendList;
|
||||
private toReceive;
|
||||
private wssocket;
|
||||
constructor(wsurl: string, onopen: OnOpenHandler, handler?: WsHandler);
|
||||
status(): WebSocket['CLOSED' | 'CLOSING' | 'CONNECTING' | 'OPEN'];
|
||||
sendNextSegment(): void;
|
||||
receiveSeg(obj: SegmentData): void;
|
||||
monitor(): void;
|
||||
send(data: string): void;
|
||||
addHandler(handler: WsHandler): void;
|
||||
}
|
||||
export {};
|
||||
Reference in New Issue
Block a user