From 9a46a824bd897e240af8a14f9d950ab6d95f42a5 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Wed, 4 Oct 2023 07:05:20 -0400 Subject: feat(jupyter): send binary data with `Deno.jupyter.broadcast` (#20755) 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. --- cli/ops/jupyter.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cli/ops/jupyter.rs') diff --git a/cli/ops/jupyter.rs b/cli/ops/jupyter.rs index 12d19fab5..f63edebe8 100644 --- a/cli/ops/jupyter.rs +++ b/cli/ops/jupyter.rs @@ -37,6 +37,7 @@ pub async fn op_jupyter_broadcast( #[string] message_type: String, #[serde] content: serde_json::Value, #[serde] metadata: serde_json::Value, + #[serde] buffers: Vec, ) -> Result<(), AnyError> { let (iopub_socket, last_execution_request) = { let s = state.borrow(); @@ -54,6 +55,7 @@ pub async fn op_jupyter_broadcast( .new_message(&message_type) .with_content(content) .with_metadata(metadata) + .with_buffers(buffers.into_iter().map(|b| b.into()).collect()) .send(&mut *iopub_socket.lock().await) .await?; } -- cgit v1.2.3