import { EventEmitter } from 'events'; import { DeepstreamConfig, DeepstreamServices, PartialDeepstreamConfig } from '@deepstream/types'; export declare class Deepstream extends EventEmitter { constants: any; private configFile; private config; private services; private messageProcessor; private messageDistributor; private eventHandler; private rpcHandler; private recordHandler; private presenceHandler; private monitoringHandler; private connectionListeners; private stateMachine; private currentState; private overrideSettings; private startWhenLoaded; /** * Deepstream is a realtime data server that supports data-sync, * publish-subscribe, request-response, listening, permissions * and a host of other features! */ constructor(config?: PartialDeepstreamConfig | string | null); /** * Set a deepstream option. For a list of all available options * please see default-options. */ set(key: string, value: any): any; /** * Returns true if the deepstream server is running, otherwise false */ isRunning(): boolean; /** * Starts up deepstream. The startup process has three steps: * * - First of all initialize the logger and wait for it (ready event) * - Then initialize all other dependencies (cache connector, message connector, storage connector) * - Instantiate the messaging pipeline and record-, rpc- and event-handler * - Start WS server */ start(): void; /** * Stops the server and closes all connections. Will emit a 'stopped' event once done */ stop(): void; getServices(): Readonly; getConfig(): Readonly; /** * Try to perform a state change */ private transition; /** * Log state transitions for debugging. */ private onTransition; private configLoaded; /** * First stage in the Deepstream initialization sequence. Initialises the logger. */ private loggerInit; /** * Invoked once the logger is initialised. Initialises all deepstream services. */ private serviceInit; /** * Invoked once all plugins are initialised. Instantiates the messaging pipeline and * the various handlers. */ private handlerInit; private pluginsInit; /** * Invoked once all dependencies and services are initialised. * The startup sequence will be complete once the connection endpoint is started and listening. */ private connectionEndpointInit; /** * Initialization complete - Deepstream is up and running. */ private run; /** * Close any (perhaps partially initialised) plugins. */ private pluginsShutdown; /** * Begin deepstream shutdown. * Closes the (perhaps partially initialised) connectionEndpoints. */ private connectionEndpointShutdown; private handlerShutdown; /** * Shutdown the services. */ private serviceShutdown; /** * Close the (perhaps partially initialised) logger. */ private loggerShutdown; /** * Final stop state. * Deepstream can now be started again. */ private stopped; /** * Synchronously loads a configuration file * Initialization of plugins and logger will be triggered by the * configInitialiser, but it should not block. Instead the ready events of * those plugins are handled through the DependencyInitialiser in this instance. */ private loadConfig; private onClientConnected; private onClientDisconnected; } export default Deepstream;