-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(jupyter): send binary data with Deno.jupyter.broadcast
#20755
Conversation
To handle that add |
Thank you! I tried this, but now I'm getting a serde error: await Deno.jupyter.broadcast("comm_msg", {
"comm_id": comm_id,
"data": {
"method": "update",
"state": { "value": 50, "a": null, "b": null },
"buffer_paths": [["a"], ["b"]]
},
}, {
"buffers": [new TextEncoder().encode("Yay"), new TextEncoder().encode("It works")]
});
|
For a separate PR (and once we get this working), it would be awesome to avoid copying buffers from JS to Rust when sending the messages (i.e., |
Since it's an async API that won't be possible. What if you try |
This works :) |
Publishing binary text data to the frontend! Screen.Recording.2023-10-03.at.11.58.10.AM.mov |
What's left? would it be good to add some tests for |
@manzt I think it's enough if you update |
Ok. I added the integration tests. As the comment notes, currently they are smoke tests to make sure we can send |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, very nice!
Adds `buffers` to the `Deno.jupyter.broadcast` API to send binary data via comms. This affords the ability to send binary data via websockets to the jupyter widget frontend.
Adds
buffers
to theDeno.jupyter.broadcast
API to send binary data via comms. This affords the ability to send binary data via websockets to the jupyter widget frontend.Currently, this just implements the correct messaging on the Rust side. I couldn't figure out how to correctly serialize
Array<Uint8Array>
from JS to Rust via the op call. Any help there would be greatly appreciated!