import { Shell } from "../Shell"; /** * The Pipe create a simple multiplexing for string messages * * @example * ```typescript * * Client 1 * const pipeA = new Pipe(ws, "A"); * pipeA.send("message sent on pipe A") * const pipeB = new Pipe(ws, "B"); * * Client 2 * const pipeA = new Pipe(ws, "A"); * pipeA.on("message", (str)=> console.log(`received ${str} on pipeA`) * const pipeB = new Pipe(ws, "B"); * pipeB.on("message", (str)=> console.log(`received ${str} on pipeB`) * ``` */ export declare class Pipe extends Shell { private static repeatString(str, count); private readonly channel; private readonly prefixLength; private pipeReadyState; /** * @param {} ws * @param {string} a string used to mark the messages channel, transparent for the user */ constructor(ws: WebSocket, channel: string); /** * Closes the WebSocket connection or connection attempt, if any. * If the connection is already CLOSED, this method does nothing. * @param {number} A numeric value indicating the status code explaining why the connection is being closed. * If this parameter is not specified, a default value of 1005 is assumed. * See the list of status codes https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes * on the CloseEvent page for permitted values. * @param {string} A human-readable string explaining why the connection is closing. * This string must be no longer than 123 bytes of UTF-8 text (not characters). */ close(code?: number, reason?: string): void; /** * Send a message through the pipe, unlike regular _send_ method, a pipe only accept string messages * @param {string} data */ send(data: string): void; /** * Dispatch an event to this EventTarget. * @param {} The Event object to be dispatched. * @returns {boolean} The return value is **false** if event is cancelable and at least one of the event * handlers which handled this event called Event.preventDefault(). Otherwise it returns true. */ dispatchEvent(evt: Event): any; protected getReadyState(): number; }