summaryrefslogtreecommitdiff
path: root/cli/ops
diff options
context:
space:
mode:
authorTrevor Manz <trevor.j.manz@gmail.com>2023-10-04 07:05:20 -0400
committerGitHub <noreply@github.com>2023-10-04 13:05:20 +0200
commit9a46a824bd897e240af8a14f9d950ab6d95f42a5 (patch)
tree9c6bf70579452767b194112d6a531c14feec5652 /cli/ops
parentda0b945804f19903beac71b23ff1040ebdb9b554 (diff)
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.
Diffstat (limited to 'cli/ops')
-rw-r--r--cli/ops/jupyter.rs2
1 files changed, 2 insertions, 0 deletions
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<deno_core::JsBuffer>,
) -> 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?;
}