Class: SocketModeClient
Defined in: packages/socket-mode/src/SocketModeClient.ts:35
A Socket Mode Client allows programs to communicate with the Slack Platform's Events API over WebSocket connections. This object uses the EventEmitter pattern to dispatch incoming events and has a built in send method to acknowledge incoming events over the WebSocket connection.
Extends
Constructors
new SocketModeClient()
new SocketModeClient(__namedParameters): SocketModeClient
Defined in: packages/socket-mode/src/SocketModeClient.ts:95
Parameters
__namedParameters
SocketModeOptions
= ...
Returns
Overrides
EventEmitter.constructor
Properties
websocket?
optional websocket: SlackWebSocket;
Defined in: packages/socket-mode/src/SocketModeClient.ts:65
The underlying WebSocket client instance
Methods
disconnect()
disconnect(): Promise<void>
Defined in: packages/socket-mode/src/SocketModeClient.ts:204
End a Socket Mode session. After this method is called no messages will be sent or received unless you call start() again later.
Returns
Promise
<void
>
onWebSocketMessage()
protected onWebSocketMessage(data, isBinary): Promise<void>
Defined in: packages/socket-mode/src/SocketModeClient.ts:288
onmessage
handler for the client's WebSocket.
This will parse the payload and dispatch the application-relevant events for each incoming message.
Mediates:
- raising the State.Connected event (when Slack sends a type:hello message)
- disconnecting the underlying socket (when Slack sends a type:disconnect message)
Parameters
data
RawData
isBinary
boolean
Returns
Promise
<void
>
start()
start(): Promise<AppsConnectionsOpenResponse>
Defined in: packages/socket-mode/src/SocketModeClient.ts:161
Start a Socket Mode session app.
This method must be called before any messages can be sent or received,
or to disconnect the client via the disconnect
method.
Returns
Promise
<AppsConnectionsOpenResponse
>