UNPKG

@hidev/udp-rcon

Version:

This node module lets you communicate with a server through the UDP RCON protocol.

60 lines (59 loc) 1.62 kB
import { EventReturn, EventCallback, Events } from "./types"; export interface UDP_RCON { /** * Send a command to the RCON server * @param cmd The command to send * @param success_cb The callback to execute on success * @param error_cb The callback to execute on error * @returns An instance of the UDP client socket that can be used to call custom events on */ send(cmd: string, success_cb?: EventCallback, error_cb?: EventCallback): UDP_INSTANCE; } export interface UDP_INSTANCE { /** * Events that are triggered when sending the event */ sender: UDP_SENDER; /** * Events that are triggered when receiving the event */ client: UDP_CLIENT; } export interface UDP_EVENTS_MANAGER { /** * The list of events that can be triggered */ events: Events; /** * Set a new event defined by a name and a callback */ setEvent(name: string, event: EventCallback): void; /** * Call a specific event by its name */ callEvent(name: string, args?: EventReturn): void; } export declare class UDP_RCON { ip: string; port: string; password: string; constructor(_ip: string, _port: string, _password: string); private initBuffer; private sendUDPSocket; } export declare class UDP_INSTANCE { sender: UDP_SENDER; client: UDP_CLIENT; constructor(); } export declare class UDP_EVENTS_MANAGER { events: Events; constructor(); } declare class UDP_SENDER extends UDP_EVENTS_MANAGER { constructor(); } declare class UDP_CLIENT extends UDP_EVENTS_MANAGER { constructor(); } export {};