Skip to content

Conversation

@itowlson
Copy link
Contributor

@itowlson itowlson commented Nov 6, 2025

It took me a while to figure out the P3 streaming incantations, and I thought others might find them useful too.

Also, I thought someone might fall around laughing and go "no, you can do it way simpler than that you cabbage," which would be an even bigger win.


// Use wit_bindgen::spawn to allow the async block to keep running
// after the handler returns.
spin_sdk::http_wasip3::wasip3::wit_bindgen::spawn(async move {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be exposing spawn from the SDK directly instead of requiring users to know the very long spin_sdk::http_wasip3::wasip3::wit_bindgen namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent question - we may want to consider that for wit_future and wit_stream as well. I'd like to put that out of scope for this PR though if that's okay?

@itowlson itowlson force-pushed the wasip3-streaming-sample branch from ccb60e3 to 4e8b417 Compare November 6, 2025 18:49
Copy link
Contributor

@fibonacci1729 fibonacci1729 left a comment

Choose a reason for hiding this comment

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

This is awesome! So clean and simple. Agree with the comment about moving some more bits into a prelude but OOB for this one.

@itowlson itowlson force-pushed the wasip3-streaming-sample branch from 4e8b417 to 7301a6d Compare November 6, 2025 20:00
@itowlson itowlson merged commit 6160d0b into spinframework:main Nov 6, 2025
3 checks passed
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.

3 participants