/// /// import { IncomingCommand, OutgoingCommand } from './schema'; import * as net from 'net'; import * as WebSocket from 'ws'; /** * Wrappers for incoming / outgoing sockets. */ /** * The unique ID for a client. * Different from a TeamID; not all clients have TeamIDs. * Generated with uuid(). */ export declare type ClientID = string; export declare class Client { /** * The UUID of this client. * Different from TeamID: not all clients have TeamIDs. */ id: ClientID; /** * The socket connected to this client. */ private socket; static fromTCP(socket: net.Socket): Client; static fromWeb(socket: WebSocket): Client; /** * Efficiently send a command to a list of clients. */ static sendToAll(command: OutgoingCommand, clients: Client[]): void; private constructor(); /** * @param callback called when command received */ onCommand(callback: (command: IncomingCommand, client: Client) => void): void; onClose(callback: (client: Client) => void): void; send(command: OutgoingCommand): void; private sendString(command); close(): void; }