Skip to content

feat: add res.stream() and app.ws() as first-class Rust-backed methods#26

Merged
Nadhila-dot merged 2 commits intomainfrom
feat/streaming-websockets
Mar 30, 2026
Merged

feat: add res.stream() and app.ws() as first-class Rust-backed methods#26
Nadhila-dot merged 2 commits intomainfrom
feat/streaming-websockets

Conversation

@JustaCube
Copy link
Copy Markdown
Collaborator

Streaming responses (res.stream):

  • Chunked transfer encoding managed by Rust with backpressure
  • JS pushes chunks via NAPI, Rust handles TCP writes
  • flume channels bridge monoio workers and JS thread

WebSocket support (app.ws):

  • Full RFC 6455 frame protocol: text, binary, ping/pong, close
  • Upgrade handshake with SHA-1 + base64 Sec-WebSocket-Accept
  • Bidirectional: ws.send() from JS, message callbacks from Rust
  • Reuses stream registry (flume + dashmap) for outbound messages

Closes #11

Streaming responses (res.stream):
- Chunked transfer encoding managed by Rust with backpressure
- JS pushes chunks via NAPI, Rust handles TCP writes
- flume channels bridge monoio workers and JS thread

WebSocket support (app.ws):
- Full RFC 6455 frame protocol: text, binary, ping/pong, close
- Upgrade handshake with SHA-1 + base64 Sec-WebSocket-Accept
- Bidirectional: ws.send() from JS, message callbacks from Rust
- Reuses stream registry (flume + dashmap) for outbound messages

Closes #11

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@blacksmith-sh
Copy link
Copy Markdown
Contributor

blacksmith-sh Bot commented Mar 29, 2026

Blacksmith Account Suspended

This Blacksmith account requires additional verification. Jobs targeting Blacksmith runners will not be picked up and will remain queued until they timeout.

Please contact Blacksmith Support for assistance.

@JustaCube JustaCube requested a review from Nadhila-dot March 29, 2026 22:40
These are valid WebSocket protocol elements that will be used as the
streaming websockets feature is built out.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Nadhila-dot Nadhila-dot merged commit bc30e7a into main Mar 30, 2026
2 checks passed
@Nadhila-dot Nadhila-dot deleted the feat/streaming-websockets branch April 1, 2026 14:48
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.

We don't have support for app.ws and res.stream() as first class rust backend methods. (DO NOT IMPLEMENT)

2 participants