Skip to content

Example websocket proof 5925307507322852050#103

Merged
Suhaibinator merged 3 commits intowebsocket-supportfrom
example-websocket-proof-5925307507322852050
Dec 15, 2025
Merged

Example websocket proof 5925307507322852050#103
Suhaibinator merged 3 commits intowebsocket-supportfrom
example-websocket-proof-5925307507322852050

Conversation

@Suhaibinator
Copy link
Owner

No description provided.

google-labs-jules bot and others added 3 commits December 15, 2025 09:06
- Add `github.com/gorilla/websocket` dependency.
- Create `examples/websocket/main.go` to demonstrate functional WebSocket support.
- Include a client test in the example to verify REST and WebSocket endpoints.
- Prove that `IsWebSocket: true` bypasses global timeouts.
@Suhaibinator Suhaibinator changed the base branch from main to websocket-support December 15, 2025 21:05
@Suhaibinator Suhaibinator merged commit addda86 into websocket-support Dec 15, 2025
9 checks passed
@Suhaibinator Suhaibinator deleted the example-websocket-proof-5925307507322852050 branch December 15, 2025 21:05
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 51.51515% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.28%. Comparing base (ef2abc7) to head (66b9ccc).
⚠️ Report is 2 commits behind head on websocket-support.

Files with missing lines Patch % Lines
pkg/router/router.go 51.51% 26 Missing and 6 partials ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##           websocket-support     #103      +/-   ##
=====================================================
- Coverage              97.35%   95.28%   -2.08%     
=====================================================
  Files                     18       18              
  Lines                   1740     1802      +62     
=====================================================
+ Hits                    1694     1717      +23     
- Misses                    34       66      +32     
- Partials                  12       19       +7     

☔ 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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 20 to +23
github.com/jinzhu/now v1.1.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/text v0.28.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/text v0.32.0 // indirect

Choose a reason for hiding this comment

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

P1 Badge Correct typoed yaml module path in go.mod

The new indirect dependency on line 22 uses the module path go.yaml.in/yaml/v2, which appears to be a misspelling of the standard gopkg.in/yaml.v2. Go will try to resolve modules by domain name, so keeping the incorrect host causes go mod tidy or any build that resolves dependencies to fail with a module download error because go.yaml.in is not the published module path. Please switch to the canonical gopkg.in/yaml.v2 or drop the entry if unused.

Useful? React with 👍 / 👎.

Suhaibinator added a commit that referenced this pull request Dec 16, 2025
* feat: Add WebSocket support by disabling timeouts for specific routes

    This commit introduces the `IsWebSocket` flag to `RouteConfigBase`.
    When set to true, this flag ensures that the router's global or sub-router
    timeout configurations are ignored for the specific route, effectively
    disabling the timeout middleware. This is necessary for long-lived
    WebSocket connections that would otherwise be terminated by the timeout.

    Changes:
    - Modified `RouteConfigBase` in `pkg/router/config.go` to include `IsWebSocket`.
    - Updated `registerSubRouter` in `pkg/router/router.go` to override timeout to 0 if `IsWebSocket` is true.
    - Updated `RegisterRoute` in `pkg/router/route.go` to override timeout to 0 if `IsWebSocket` is true.
    - Added `TestWebSocketRoute` in `pkg/router/websocket_test.go`.
    - Updated `README.md` with documentation and usage examples.

* test: add more comprehensive tests for WebSocket support

    Expanded the test suite to cover WebSocket support in both top-level
    routers and sub-routers. This ensures that the `IsWebSocket` flag
    correctly disables timeouts in all routing scenarios.

* add support for hijacking connections

* test: enhance WebSocket route tests for hijacking behavior

* test: add ResponseController tests for WebSocket route deadlines and full duplex

* Add minimal WebSocket example application (#102)

* feat: add minimal websocket example app

- Add `github.com/gorilla/websocket` dependency.
- Create `examples/websocket/main.go` to demonstrate functional WebSocket support.
- Include a client test in the example to verify REST and WebSocket endpoints.
- Prove that `IsWebSocket: true` bypasses global timeouts.

* refactor: simplify router initialization and update dependencies

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Suhaib <suhaib.abdulquddos@gmail.com>

* Example websocket proof 5925307507322852050 (#103)

* feat: add minimal websocket example app

- Add `github.com/gorilla/websocket` dependency.
- Create `examples/websocket/main.go` to demonstrate functional WebSocket support.
- Include a client test in the example to verify REST and WebSocket endpoints.
- Prove that `IsWebSocket: true` bypasses global timeouts.

* refactor: simplify router initialization and update dependencies

* fix: improve timeout handling in mutexResponseWriter to prevent race conditions

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

* test: add race condition tests for timeout middleware

* test: add tests for Base64 and Base62 query parameter decoding errors

* test: add tests for CORS headers and logging in JSON error responses

* Rename IsWebSocket to DisableTimeout in RouteConfigBase (#104)

This is a breaking change that renames the `IsWebSocket` field to `DisableTimeout`
in `RouteConfigBase`. This new name better reflects the flag's purpose, which is
to disable the global or sub-router timeout for any long-lived connection, such
as WebSockets or Server-Sent Events (SSE).

Updates:
- `pkg/router/config.go`: Renamed field and updated comments.
- `pkg/router/route.go` & `pkg/router/router.go`: Updated logic to use `DisableTimeout`.
- `pkg/router/websocket_test.go`: Updated tests.
- `examples/websocket/main.go`: Updated example.
- `README.md`: Updated documentation.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

* refactor: standardize formatting in WebSocket route configuration

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Suhaibinator <42899065+Suhaibinator@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments