Skip to content

[codex] add native WebSocket gateways#126

Merged
ItayTheDar merged 1 commit into
auspicious-dartfrom
indispensable-offer
May 9, 2026
Merged

[codex] add native WebSocket gateways#126
ItayTheDar merged 1 commit into
auspicious-dartfrom
indispensable-offer

Conversation

@ItayTheDar
Copy link
Copy Markdown
Contributor

@ItayTheDar ItayTheDar commented May 9, 2026

Summary

  • Add nest.websockets with native FastAPI WebSocket gateway support: @WebSocketGateway, @SubscribeMessage, MessageBody, ConnectedSocket, lifecycle hooks, ExecutionContext, and WebSocketServer helpers.
  • Register gateway providers through the PR feat(di): rewrite DI engine — proper injector integration, instance-based routing, provider normalization #125 DI/router architecture by resolving gateway instances from provider descriptors.
  • Add pynest generate gateway scaffolding.
  • Add unit, integration, and CLI tests for gateway metadata, dispatch, guards, lifecycle, rooms/broadcast helpers, real async WebSocket clients, token streaming, and WebSocket/HTTP controller/provider integration.
  • Add full WebSocket documentation and discovery links in README/getting-started/intro/guards/CLI docs.

Stacking note

This PR targets auspicious-dart because it depends on PR #125's DI/container rewrite. Once PR #125 lands in main, this PR can be retargeted to main.

Validation

  • uv run --group test python -m pytest tests → 156 passed
  • uv run --group docs mkdocs build --clean → passed
  • git diff --check → passed

@ItayTheDar ItayTheDar force-pushed the indispensable-offer branch from 0b12067 to b748f14 Compare May 9, 2026 21:23
@ItayTheDar ItayTheDar marked this pull request as ready for review May 9, 2026 21:26
@ItayTheDar ItayTheDar force-pushed the indispensable-offer branch 2 times, most recently from 824205d to 469f89f Compare May 9, 2026 21:28
@ItayTheDar ItayTheDar force-pushed the indispensable-offer branch from 469f89f to 042c8d1 Compare May 9, 2026 21:33
@ItayTheDar ItayTheDar merged commit 4661ca9 into auspicious-dart May 9, 2026
30 checks passed
ItayTheDar added a commit that referenced this pull request May 10, 2026
* feat: add websocket gateways (#126)

* test(cli): add e2e test that generates a gateway and runs it as a websocket app

Loads the scaffolded chat_gateway.py via importlib, wires it into a Module,
boots a uvicorn server, and verifies the generated `ping` handler returns
`pong` over a real websocket connection.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* ci(cli): exercise `pynest generate gateway` in CLI smoke matrix

Adds a `pynest generate gateway -n chat -p src` step to the CLI test
workflow and asserts the generated file exists with the expected
@WebSocketGateway decorator across all app-type variants.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* ci(cli): boot generated gateway and verify it responds to a real ping

Adds a Blank-only step that loads the scaffolded chat_gateway.py, boots
it via PyNestFactory + uvicorn, opens a websocket to /chat and asserts
the {event:ping} → {event:pong} round-trip. Gated to the Blank matrix
variant since DB-backed apps would fail to boot without their database.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.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