import { SocketOptions } from "./socket"; import { StreamClient } from "../types/stream-client"; import { Socket } from "../types/socket"; /** * The set of options that can be used when constructing a the default * [[StreamClient]] instance through the [[createStreamClient]] factory * method. */ export interface StreamClientOptions { /** * The [[Socket]] instance to use, inferred based on the environment when not provided. * * @default `undefined` (Inferred based on runtime environment (Node.js/Browser), see [[createSocket]]) */ socket?: Socket; /** * The [[SocketOptions]] to pass when creating the default [[Socket]] instance. * This field has no effect if you provide yourself a [[StreamClientOptions.socket]] option. * * @default `undefined` (See [[SocketOptions]] for actual defaults this generates) */ socketOptions?: SocketOptions; /** * Determines all streams should automatically restart when the socket disconnects. The stream * will re-connect at their latest marked value (See [[Stream.mark]]) if present or at current * block if it was never marked. * * @default `true` */ autoRestartStreamsOnReconnect?: boolean; /** * When sets to `true`, when no more streams are active, the socket is * automatically disconnected and close. This option should be set to * `false` when using `Query` or `Mutation` over WebSocket transport * to avoid opening/closing the WebSocket connection for each operation * or when multiple short lived `Subscription`s are used. * * @default `true` */ autoDisconnectSocket?: boolean; } /** * Create the default [[StreamClient]] concrete implementation. * * @param wsUrl The url used to reach the dfuse Stream API, should **not** contain the `token` query parameter. Passed as * is to created [[Socket]] interface through the [[createSocket]] factory method. This parameter has no effect * if [[StreamClientOptions.socket]] options is used. * @param options The set of options used to construct the default [[StreamClient]] instance. See * [[StreamClientOptions]] for documentation of the options and default values for each of them. */ export declare function createStreamClient(wsUrl: string, options?: StreamClientOptions): StreamClient;