import type { WebClientOptions } from '@slack/web-api'; import type { Logger, LogLevel } from './logger'; /** * A structural type representing an HTTP dispatcher compatible with undici's fetch and WebSocket. * Any undici `Agent`, `ProxyAgent`, `Client`, or custom `Dispatcher` subclass satisfies this interface. * * Defining this structurally allows consumers to use different compatible undici versions * without type conflicts. */ export interface SocketModeDispatcher { /** * Dispatches an HTTP request through this dispatcher. * @param options - The request options (method, path, headers, body, etc.) * @param handler - The response handler that processes incoming data and events */ dispatch(options: any, handler: any): boolean; } export interface SocketModeOptions { /** * The App-level token associated with your app, located under the Basic Information page on api.slack.com/apps. */ appToken: string; /** * An instance of `@slack/logger`'s Logger interface, to send log messages to. */ logger?: Logger; /** * An instance of `@slack/logger`'s LogLevel enum, setting the minimum log level to emit log messages for. */ logLevel?: LogLevel; /** * Whether the client should automatically reconnect when the socket mode connection is disrupted. Defaults to `true`. * Note that disconnects are regular and expected when using Socket Mode, so setting this to `false` will likely lead * to a disconnected client after some amount of time. */ autoReconnectEnabled?: boolean; /** * How long the client should wait for a `pong` response to the client's `ping` to the server, in milliseconds. * If this timeout is hit, the client will attempt to reconnect if `autoReconnectEnabled` is `true`; * otherwise, it will disconnect. * Defaults to 5,000. */ clientPingTimeout?: number; /** * How long the client should wait for `ping` messages from the server, in milliseconds. * If this timeout is hit, the client will attempt to reconnect if `autoReconnectEnabled` is `true`; * otherwise, it will disconnect. * Defaults to 30,000. */ serverPingTimeout?: number; /** * Should logging related to `ping` and `pong` messages between the client and server be logged at a * `LogLevel.DEBUG` level. Defaults to `false. */ pingPongLoggingEnabled?: boolean; /** * The `@slack/web-api` `WebClientOptions` to provide to the HTTP client interacting with Slack's HTTP API. * Useful for setting retry configurations and custom fetch implementations. */ clientOptions?: Omit; /** * A {@link SocketModeDispatcher} used for the WebSocket connection and, if no custom `fetch` is provided * via `clientOptions`, also wrapped into a custom fetch for HTTP API calls. * If `clientOptions.fetch` is already defined, the dispatcher is only used for the WebSocket connection. * * Use this to configure proxies or custom TLS behavior. * * @example * ```js * // Using undici's ProxyAgent as the dispatcher * import { ProxyAgent } from 'undici'; * const dispatcher = new ProxyAgent('http://proxy:3128'); * ``` */ dispatcher?: SocketModeDispatcher; } //# sourceMappingURL=SocketModeOptions.d.ts.map