@hrtk92/mcwsjs
Version:
  [](https://github.com/HRTK92/mcws.js/actions/workflows
35 lines (34 loc) • 960 B
TypeScript
import { WebSocket } from 'ws';
type Data = {
header: {
messagePurpose: string;
requestId: string;
version: number;
};
body: {
eventName: string;
[key: string]: any;
};
};
declare class mswc {
private host;
private port;
private server;
private ws;
private debug;
constructor(host?: string, port?: number, debug?: boolean);
private readyCallback;
onReady(callback: (host: string, port: number) => void): void;
private connectionCallback;
onConnection(callback: (client: WebSocket) => void): void;
private dissconnectCallback;
onDisconnect(callback: () => void): void;
private eventCallbacks;
on(eventName: string, callback: (data: Data) => void): void;
createServer(): void;
disconnect(): void;
subscribe(eventName: string): void;
unsubscribe(eventName: string): void;
sendCommand(command: string): void;
}
export default mswc;