@cimo/websocket
Version:
Websocket (server/client). Light, fast and secure.
30 lines (29 loc) • 745 B
TypeScript
export type TreceiveData = string | DataView;
export type TreceiveDataDownalod = {
mimeType: string;
fileName: string;
} | DataView;
export type TsendData = string | Record<string, unknown> | ArrayBuffer;
export interface Iclient {
socket: WebSocket;
}
export interface IhandleReceiveData {
tag: string;
callback: IcallbackReceiveData<TreceiveData>;
}
export interface IcallbackReceiveData<T> {
(data: T): void;
}
export interface IcallbackReceiveDataDownload {
(data: DataView, mimeType: string, fileName: string): void;
}
export interface Imessage {
tag: string;
data: string;
}
export interface ImessageDirect {
time: string;
content: TsendData;
fromClientId: string;
toClientId: string;
}