32 lines
904 B
TypeScript
32 lines
904 B
TypeScript
import { Message } from '../message';
|
|
import { Feature } from '../../types/Feature';
|
|
import SocketPoint from './socketPoint';
|
|
export type SocketEvent = {
|
|
event: 'connect';
|
|
} | {
|
|
event: 'disconnect';
|
|
} | {
|
|
event: 'connect_error';
|
|
reason: any;
|
|
} | {
|
|
event: 'data';
|
|
data: any;
|
|
};
|
|
export declare class Socket extends Feature {
|
|
private socketPoint;
|
|
private url?;
|
|
private path?;
|
|
private io?;
|
|
private message;
|
|
constructor(message: Message, socketPoint: SocketPoint);
|
|
private initSocketPoint;
|
|
private connectQueue;
|
|
private ioState;
|
|
private onConnected;
|
|
connect(): Promise<unknown>;
|
|
emit(event: string, data: any, callback?: Function): Promise<void>;
|
|
disconnect(): void;
|
|
on(event: string, callback: (...args: any[]) => void | Promise<void>): void;
|
|
off(event: string, callback?: (...args: any[]) => void | Promise<void>): void;
|
|
}
|