mudvault-mesh
Version:
Node.js client library for connecting to MudVault Mesh network
42 lines • 1.76 kB
TypeScript
import { EventEmitter } from 'events';
import { MeshMessage, MessageEndpoint, UserInfo, ConnectionState, MeshClientOptions } from './types';
export declare class MeshClient extends EventEmitter {
private ws;
private options;
private state;
private heartbeatTimer;
private reconnectTimer;
private gatewayUrl;
constructor(options: MeshClientOptions);
connect(gatewayUrl?: string, apiKey?: string): Promise<void>;
disconnect(): void;
private authenticate;
private handleMessage;
private handlePing;
private handlePong;
private handleDisconnection;
private scheduleReconnect;
private startHeartbeat;
private sendMessage;
sendTell(to: MessageEndpoint, message: string): void;
sendChannelMessage(channel: string, message: string, user?: string): void;
joinChannel(channel: string, user?: string): void;
leaveChannel(channel: string, user?: string): void;
requestWho(targetMud: string): void;
requestFinger(targetMud: string, targetUser: string): void;
requestLocate(targetUser: string): void;
setUserOnline(userInfo: UserInfo): void;
setUserOffline(username: string): void;
isConnected(): boolean;
isAuthenticated(): boolean;
getConnectionState(): ConnectionState;
getMudName(): string;
onTell(handler: (message: MeshMessage) => void): this;
onChannel(handler: (message: MeshMessage) => void): this;
onWho(handler: (message: MeshMessage) => void): this;
onFinger(handler: (message: MeshMessage) => void): this;
onLocate(handler: (message: MeshMessage) => void): this;
onEmote(handler: (message: MeshMessage) => void): this;
onEmoteTo(handler: (message: MeshMessage) => void): this;
}
//# sourceMappingURL=client.d.ts.map