Skip to main content
Module

x/slack_bolt/deps.ts>SocketModeClient

TypeScript framework to build Slack apps in a flash with the latest platform features. Deno port of @slack/bolt
Latest
class SocketModeClient
extends TypedEventTarget<Events>
import { SocketModeClient } from "https://deno.land/x/slack_bolt@1.0.0/deps.ts";

An Socket Mode Client allows programs to communicate with the Slack Platform's Events API over a websocket. This object uses the EventEmitter pattern to dispatch incoming events and has a built in send method to acknowledge incoming events over the websocket.

Constructors

new
SocketModeClient(unnamed 0?: SocketModeOptions)

Used to see if a websocket stops sending heartbeats and is deemed bad TODO

Properties

private
autoReconnectEnabled

Whether this client will automatically reconnect when (not manually) disconnected

private
logger: Logger

This object's logger instance

private
optional
secondaryWebsocket: WebSocket
private
stateMachine: StateMachine<string, string>

State machine that backs the transition and action behavior

private
stateMachineConfig

Configuration for the state machine

private
webClient: WebClient
authenticated: boolean

Whether or not the client has authenticated to the Socket Mode API. This occurs when the connect method completes, and a WebSocket URL is available for the client's connection.

connected: boolean

Whether or not the client is currently connected to the web socket

optional
websocket: WebSocket

The client's websockets

Methods

private
onWebsocketMessage(unnamed 0: { data: string; }): void

onmessage handler for the client's websocket. This will parse the payload and dispatch the relevant events for each incoming message.

private
send(id: string, body?): Promise<void>

Method for sending an outgoing message of an arbitrary type over the websocket connection. Primarily used to send acknowledgements back to slack for incoming events

private
setupWebSocket(url: string): void

Set up method for the client's websocket instance. This method will attach event listeners.

private
teardownWebsocket(): void

Tear down method for the client's websocket instance. This method undoes the work in setupWebSocket(url).

disconnect(): Promise<void>

End a Socket Mode session. After this method is called no messages will be sent or received unless you call start() again later.

Begin an Socket Mode session. This method must be called before any messages can be sent or received.

Static Properties

private
loggerName: string

The name used to prefix all logging generated from this object