UNPKG

ziron-broker

Version:
42 lines (41 loc) 1.52 kB
import BrokerServerOptions from "./BrokerServerOptions"; import { Server } from "ziron-server"; import { StandaloneProcedures } from "ziron-server/dist/lib/Procedure"; import { StandaloneReceivers } from "ziron-server/dist/lib/Receiver"; export declare class BrokerServer { get id(): string; readonly stateId?: string; private readonly _options; private readonly _logger; private readonly _joinSecret; private readonly _joinUri; /** * @description * Use the server object carefully. * Never change properties on the server; use it only to access state information. * @protected */ protected readonly server: Server; private _stateSocket; protected readonly procedures: StandaloneProcedures; protected readonly receivers: StandaloneReceivers; constructor(options?: BrokerServerOptions); isConnectedToState(): boolean; protected listen(): Promise<void>; listenAndJoin(): Promise<void>; private _initServer; /** * Starts joining the cluster. * Returns a promise that will be fulfilled when the broker has joined for the first time. * Notice that the broker will automatically retry rejoining in case of disconnections. * @protected */ protected join(): Promise<void>; /** * Terminates the broker. * After termination, you should not use this instance anymore * or anything else from the broker. * [Use this method only when you know what you do.] */ terminate(): void; }