feat(socket-mode): emit a hello event with the connection handshake payload - #2695
Open
deepunyk wants to merge 1 commit into
Open
feat(socket-mode): emit a hello event with the connection handshake payload#2695deepunyk wants to merge 1 commit into
deepunyk wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 3341305 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
deepunyk
force-pushed
the
feat/socket-mode-hello-event
branch
from
August 11, 2026 14:44
bc3d90d to
27170ce
Compare
Slack sends a hello message once the Socket Mode handshake completes, but the client discarded it and only emitted the connected state. That left num_connections, debug_info and connection_info visible in debug logs only. Emit the parsed message as a hello event, typed as HelloMessage, just before the connected state so listeners registered before start() see the handshake details before start() resolves. Closes slackapi#2253
deepunyk
force-pushed
the
feat/socket-mode-hello-event
branch
from
August 11, 2026 15:17
27170ce to
3341305
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2253.
Slack sends a
hellomessage once it finalizes the Socket Mode handshake.SocketModeClientparses that message, logs it at debug level, then discards it and emits only theconnectedstate — sonum_connections,debug_infoandconnection_infowere reachable only by scraping debug logs.This takes the first option suggested in the issue: emit the parsed message as its own
helloevent.What changed
SocketModeClientemitshellowith the parsed handshake message. It fires just before theconnectedstate, becausestart()resolves onconnectedand a listener attached after that would miss the first connection's handshake.HelloMessagetype, along withHelloMessageDebugInfoandHelloMessageConnectionInfo, following the payload documented in Using Socket Mode.typeandnum_connectionsare required; the nested objects and their fields are optional.packages/socket-mode/README.mdgains ahellorow and a short example.Existing behaviour is unchanged:
connectedstill fires with the same argument, andhellostill returns early rather than reachingslack_eventlisteners, since it carries noenvelope_idtoack.How users can take advantage of these changes
Detecting that a second instance of an app is holding the same app-level token:
Estimating when Slack will refresh the connection:
Testing
Three unit tests were added under the
onWebSocketMessagedescribe inSocketModeClient.test.ts, alongside the existingslash_commands,events_apiandinteractivitygroups: the payload reaching ahellolistener, thehello-then-connectedordering, andhellonot leaking intoslack_eventlisteners.One integration test covers the same ordering against the WebSocket server double, asserting the payload has arrived by the time
start()resolves. The double's handshake message now includesnum_connections, so it matches what Slack actually sends.Test app.ts
Start a second copy against the same app-level token to see
num_connectionsclimb.Requirements