Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sfc-gh-nbellante
Copy link
Contributor

@sfc-gh-nbellante sfc-gh-nbellante commented Aug 5, 2025

Describe your changes

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.

@snyk-io
Copy link
Contributor

snyk-io bot commented Aug 5, 2025

🎉 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)

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12117/streamlit-1.47.1-py3-none-any.whl
🕹️ Preview app pr-12117.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-nbellante sfc-gh-nbellante added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Aug 5, 2025
@sfc-gh-nbellante sfc-gh-nbellante changed the title adding the config option and tests [feature] Add configurable websocket ping interval to fix proxy connection drops Aug 5, 2025
@sfc-gh-nbellante sfc-gh-nbellante changed the title [feature] Add configurable websocket ping interval to fix proxy connection drops [feat] Add configurable websocket ping interval to fix proxy connection drops Aug 5, 2025
@sfc-gh-nbellante sfc-gh-nbellante marked this pull request as ready for review August 5, 2025 01:17
@sfc-gh-nbellante sfc-gh-nbellante requested a review from a team as a code owner August 5, 2025 01:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.websocketPingInterval with appropriate documentation and validation
  • Refactored hardcoded TORNADO_SETTINGS into dynamic get_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 "

Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@sfc-gh-nbellante sfc-gh-nbellante merged commit 0fcda8b into develop Aug 5, 2025
36 checks passed
@sfc-gh-nbellante sfc-gh-nbellante deleted the nico/add-config-option-for-websocket-ping-interval branch August 5, 2025 17:02
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frequent websocket connection drops on higher (default 30s) ping_interval

4 participants