Feature Request: Expose hello event data (e.g., num_connections, debug_info) in SocketModeClient

Offen
#2,253 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@deepunyk arbeitet bereits daran.

Seit 11.8.2026.

  • #2695 von @deepunyk — offen

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
typescript
Bereich
api

Rechercherichtung

Beginne damit, den im Issue verlinkten Abschnitt von SocketModeClient.ts ungefähr in den Zeilen 318–321 zu lesen, und vergleiche ihn mit der DEBUG-Ausgabe für die empfangene hello-Nachricht. Ermittle die benötigte öffentliche API für num_connections, debug_info und connection_info.app_id; die Arbeit ist abgeschlossen, wenn diese Werte programmgesteuert und nicht nur in Logs verfügbar sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

discussion enhancement pkg:socket-mode

(Describe your issue and goal here)

Goal:
Our goal is to programmatically access crucial information from the hello event sent by Slack upon establishing a Socket Mode connection. Specifically, we need num_connections to implement reliable "double-launch detection" for our application. Additionally, debug_info and connection_info.app_id (as provided in the hello event) would be very useful for enhanced diagnostics and connection verification.

Issue:
The @slack/socket-mode client successfully receives the hello event from Slack. This is evident from the SDK's own DEBUG logs, which show the complete hello payload including num_connections, debug_info, and connection_info.app_id. For example:
[timestamp] DEBUG (slack-socket/pid): Received a message on the WebSocket: {"type":"hello","num_connections":N,"debug_info":{...},"connection_info":{"app_id":"A..."}}

However, despite the SDK receiving this information, its contents (especially num_connections) are not exposed to the SDK user through any readily accessible public API:

This lack of access prevents developers from:

  1. Using num_connections to programmatically detect and manage multiple running instances of their Socket Mode application.
  2. Easily accessing debug_info or connection_info.app_id (from the hello event context) for application-level logging, diagnostics, or connection verification.

Proposed Solution/Suggestion:
We request that the SocketModeClient expose key information from the hello event. Ideal ways to implement this could be:

  1. Emit a new, dedicated hello event with the parsed hello message payload:
    client.on('hello', (payload) => {
      // payload would be the parsed content of the hello message
      // const { num_connections, debug_info, connection_info } = payload;
      console.log(`App ${payload.connection_info.app_id} connected. Active connections: ${payload.num_connections}`);
    });
    
  2. Enhance the connected event's payload to include the hello payload or selected fields from it.
  3. Expose relevant hello data as properties on the SocketModeClient instance after the hello message is processed (e.g., client.numConnections, client.socketDebugInfo, client.socketAppId).

Access to num_connections is the primary motivation, but making debug_info and connection_info also available would greatly benefit developers.

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • @slack/types
  • I don't know
Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.


Use Case Example / Motivation:

The primary use case is "double-launch detection" . A bot developer wants to ensure only one instance of their Socket Mode bot is running using a specific app-level token. By checking num_connections upon startup, if it's greater than 1, the newly started instance can decide to log a warning, shut itself down gracefully, or enter a standby mode. This helps prevent redundant processing, unexpected behavior, and potential rate limit issues.

Current Limitations / Workarounds:

Currently, this vital information (num_connections, etc., from the hello event) is only visible within the SDK's internal DEBUG logs. Relying on parsing DEBUG logs is not a robust or recommended programmatic approach. Implementing alternative instance tracking mechanisms (e.g., using an external datastore like Redis) adds significant complexity compared to directly utilizing a value that Slack already provides to the client.

Environment:
  • Package Version (@slack/socket-mode): 2.0.4 (as observed in logs, but request applies to current/future versions)
  • Node.js Version: v22.12.0
Additional Context:

The DEBUG logs clearly show the hello message being received internally by the SDK:
[13:11:46.908] DEBUG (slack-socket/80817): Received a message on the WebSocket: {"type":"hello","num_connections":2,"debug_info":{"host":"applink-8",...},"connection_info":{"app_id":"A08SDQ16LUV"}}

The challenge is the absence of a public API to access these details programmatically.

Thank you for considering this feature request. Exposing this information would greatly improve the capabilities for developers building robust and diagnosable applications using Socket Mode.

Vorherrschende Sprache
TypeScript
Sterne
3.4k
Forks
694
Ø Merge
1 T. 10 Std.
Gemergte PRs (30 T.)
75

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus slackapi/node-slack-sdk

Alle Issues in slackapi/node-slack-sdk

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.