[feat] Add configurable websocket ping interval to fix proxy connection drops#12117
Merged
sfc-gh-nbellante merged 2 commits intodevelopfrom Aug 5, 2025
Merged
Conversation
Contributor
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new configurable option server.websocketPingInterval to allow users to customize the websocket ping interval in Streamlit. This addresses connection drop issues experienced by users with certain proxy setups after upgrading to Streamlit 1.47.0 (which includes Tornado 6.5.1).
Key changes:
- Added new configuration option
server.websocketPingIntervalwith appropriate documentation and validation - Refactored hardcoded
TORNADO_SETTINGSinto dynamicget_tornado_settings()function that respects the new configuration - Added comprehensive test coverage for all scenarios including version-specific behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lib/streamlit/config.py |
Adds the new server.websocketPingInterval configuration option with detailed documentation |
lib/streamlit/web/server/server.py |
Refactors tornado settings from static dict to dynamic function, implements ping interval logic with version-aware defaults |
lib/tests/streamlit/config_test.py |
Updates test to include the new config option in the expected list |
lib/tests/streamlit/web/server/server_test.py |
Adds comprehensive test coverage for the new functionality including default behavior, custom configuration, and version-specific constraints |
Comments suppressed due to low confidence (1)
lib/streamlit/web/server/server.py:79
- The URL reference points to a specific GitHub comment that may not exist or be accessible. Consider using a more general documentation link or the main pull request URL.
"https://github.com/tornadoweb/tornado/pull/3376#issuecomment-2984887076 "
sfc-gh-lmasuch
approved these changes
Aug 5, 2025
sfc-gh-nbellante
added a commit
that referenced
this pull request
Aug 5, 2025
…on drops (#12117) ## Describe your changes <!-- If it's a visual change, please include a screenshot or video! --> Added a new configuration option `server.websocketPingInterval` to allow users to customize the websocket ping interval. This addresses connection drops experienced by users with certain proxy setups after upgrading to Streamlit `1.47.0` (which includes Tornado 6.5.1). ## GitHub Issue Link (if applicable) Fixes #12108 ## Testing Plan - Added unit tests covering all scenarios: - Default behavior for both Tornado versions - Custom configuration behavior - Version-specific constraints using mocking - All existing tests pass - Linting checks pass --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
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.
Describe your changes
Added a new configuration option
server.websocketPingIntervalto allow users to customize the websocket ping interval. This addresses connection drops experienced by users with certain proxy setups after upgrading to Streamlit1.47.0(which includes Tornado 6.5.1).GitHub Issue Link (if applicable)
Fixes #12108
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.