Skip to content

feat(SocketModeReceiver): expose Socket Mode timeout and reconnect options#2786

Merged
vegeris merged 1 commit intoslackapi:mainfrom
shivasymbl:feat/expose-socket-mode-timeout-options
Feb 12, 2026
Merged

feat(SocketModeReceiver): expose Socket Mode timeout and reconnect options#2786
vegeris merged 1 commit intoslackapi:mainfrom
shivasymbl:feat/expose-socket-mode-timeout-options

Conversation

@shivasymbl
Copy link
Contributor

Summary

SocketModeClient (from @slack/socket-mode) accepts clientPingTimeout, serverPingTimeout, pingPongLoggingEnabled, and autoReconnectEnabled options, but SocketModeReceiver does not pass these through — forcing users to accept hardcoded defaults.

This is problematic because Slack's WebSocket servers frequently take >5000ms to respond to pings (see #2496), causing unnecessary disconnections with the default 5000ms clientPingTimeout. Users have no way to increase the timeout without bypassing SocketModeReceiver entirely.

Changes

  • Add clientPingTimeout, serverPingTimeout, pingPongLoggingEnabled, and autoReconnectEnabled as optional properties on SocketModeReceiverOptions
  • Pass these options through to the SocketModeClient constructor
  • When not provided, values default to undefined, preserving existing SocketModeClient defaults (fully backward compatible)

Usage

const app = new App({
  socketMode: true,
  appToken: process.env.SLACK_APP_TOKEN,
  token: process.env.SLACK_BOT_TOKEN,
  // Increase ping timeout to handle slow Slack server responses
  clientPingTimeout: 15000,
  serverPingTimeout: 60000,
  pingPongLoggingEnabled: true,
});

Test plan

  • 4 new unit tests verifying option passthrough via constructor spy
  • Backward compatibility test confirming undefined defaults when options are omitted
  • All 404 existing tests continue to pass
  • TypeScript compilation clean (0 errors)
  • Biome lint clean (0 issues)

Fixes #2496

Category

  • @slack/bolt (npm package)

…tions

SocketModeClient accepts clientPingTimeout, serverPingTimeout,
pingPongLoggingEnabled, and autoReconnectEnabled, but SocketModeReceiver
does not pass these through, forcing users to accept hardcoded defaults.

This is problematic because Slack's servers frequently take >5000ms to
respond to pings (see slackapi#2496), causing unnecessary disconnections with
the default 5000ms clientPingTimeout.

Changes:
- Add clientPingTimeout, serverPingTimeout, pingPongLoggingEnabled, and
  autoReconnectEnabled to SocketModeReceiverOptions interface
- Pass these options through to the SocketModeClient constructor
- Add tests verifying option passthrough and backward compatibility

Fixes slackapi#2496
@shivasymbl shivasymbl requested a review from a team as a code owner February 11, 2026 20:53
@salesforce-cla
Copy link

Thanks for the contribution! Before we can merge this, we need @shivasymbl to sign the Salesforce Inc. Contributor License Agreement.

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.45%. Comparing base (128100c) to head (0a65546).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2786      +/-   ##
==========================================
+ Coverage   93.44%   93.45%   +0.01%     
==========================================
  Files          37       37              
  Lines        7677     7689      +12     
  Branches      669      669              
==========================================
+ Hits         7174     7186      +12     
  Misses        498      498              
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vegeris vegeris added enhancement M-T: A feature request for new functionality bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented and removed enhancement M-T: A feature request for new functionality labels Feb 12, 2026
@vegeris
Copy link
Contributor

vegeris commented Feb 12, 2026

Thank you for identifying and fixing this! We just need you to sign the Contributor License Agreement to proceed :)

@shivasymbl
Copy link
Contributor Author

I actually did but not sure why it doesn't update here

@shivasymbl
Copy link
Contributor Author

image

@vegeris
Copy link
Contributor

vegeris commented Feb 12, 2026

I'm going to close and re-open this PR to trigger the CLA check to run again 😅

@vegeris vegeris closed this Feb 12, 2026
@vegeris vegeris reopened this Feb 12, 2026
@vegeris vegeris merged commit e35ca5c into slackapi:main Feb 12, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented cla:signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connection Issue: socket-mode:SlackWebSocket:14 A pong wasn't received from the server before the timeout of 5000ms!

2 participants