import type { JsonSchema } from 'autumndb'; import { JellyfishSDK } from '.'; import type { ExtendedSocket, SdkQueryOptions } from './types'; /** * @class JellyfishStreamManager * * @description Manager for opening multiple streams through a single socket * connection the API */ export declare class JellyfishStreamManager { private sdk; private activeSockets; /** * @summary Create a JellyfishStreamManager * @class * * @param {Object} sdk - An instantiated instance of JellyfishSDK */ constructor(sdk: JellyfishSDK); /** * @summary Stream updates and additions, filtered using a JSON schema * @name stream * @public * @function * * @param {JsonSchema} query - An optional JSON schema used to match cards * Returns a socket object that emits response data for the given query * @param {SdkQueryOptions} options - Extra query options to use * * @fulfil {JellyfishStream} An instantiated JellyfishStream * @returns {Promise} * * @example * const schema = { * type: 'object', * properties: { * type: { * const: 'thread' * } * } * }; * * const stream = jellyfishStreamManager.stream(schema) * * stream.on('update', (data) => { * console.log(data); * }) * * stream.on('streamError', (error) => { * console.error(error); * }) */ stream(query: JsonSchema, options?: SdkQueryOptions): ExtendedSocket; /** * @summary Close main socket and remove all event socket * @name close * @public * @function * * @example * jellyfishStreamManager.close() */ close(): void; }