Feature Request: Expose hello event data (e.g., num_connections, debug_info) in SocketModeClient
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- api
Direzione di ricerca
Inizia leggendo la sezione di SocketModeClient.ts collegata nell’issue, intorno alle righe 318-321, e confrontala con l’output DEBUG del messaggio hello ricevuto. Determina l’API pubblica necessaria per num_connections, debug_info e connection_info.app_id; il lavoro è completato quando questi valori sono disponibili programmaticamente anziché solo nei log.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
(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:
- The
connectedevent fires, but its payload isundefined(or does not containhellodata).
https://github.com/slackapi/node-slack-sdk/blob/main/packages/socket-mode/src/SocketModeClient.ts#L318-L321
This lack of access prevents developers from:
- Using
num_connectionsto programmatically detect and manage multiple running instances of their Socket Mode application. - Easily accessing
debug_infoorconnection_info.app_id(from thehelloevent 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:
- Emit a new, dedicated
helloevent with the parsedhellomessage 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}`); }); - Enhance the
connectedevent's payload to include thehellopayload or selected fields from it. - Expose relevant
hellodata as properties on theSocketModeClientinstance after thehellomessage 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.
- Lingua principale
- TypeScript
- Stelle
- 3.4k
- Fork
- 693
- Merge medio
- 1g 1h
- PR unite (30g)
- 67
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di slackapi/node-slack-sdk
-
auto-triage-skip enhancement pkg:web-api
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
slackapi/node-slack-sdk#2607 · 2 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
`SlackListsItem FieldMessage.message` type does not match API response shapeForse già presa @AjTheSpidey l’ha presa 202 giorni fa. Apertaarea:typescript auto-triage-skip bug pkg:web-api
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
slackapi/node-slack-sdk#2598 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Missing TypeScript response type for files.uploadV2Forse già presa @Yshuro l’ha presa 6 giorni fa. Apertaarea:typescript auto-triage-skip bug pkg:web-api
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
slackapi/node-slack-sdk#2459 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Docs/types: document `broadcast_delete` on chat.delete (undo reply_broadcast)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea:typescript enhancement pkg:web-api semver:patch
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
slackapi/node-slack-sdk#2815 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
auto-triage-stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 75/100
slackapi/node-slack-sdk#2791 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di slackapi/node-slack-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
agilepathway/label-checker#1015 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug P3
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
react-component/image#541 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno