From 7bcf1211a1494c188c9de83670d328c0492de98a Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Fri, 29 Sep 2023 18:24:09 -0400 Subject: feat(jupyter): send Jupyter messaging metadata with `Deno.jupyter.broadcast` (#20714) Exposes [`metadata`](https://jupyter-client.readthedocs.io/en/latest/messaging.html#metadata) to the `Deno.jupyter.broadcast` API. ```js await Deno.jupyter.broadcast(msgType, content, metadata); ``` The metadata is required for [`"comm_open"`](https://github.com/jupyter-widgets/ipywidgets/blob/main/packages/schema/messages.md#instantiating-a-widget-object-1) for with `jupyter.widget` target. --- cli/tools/jupyter/jupyter_msg.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/tools/jupyter/jupyter_msg.rs') diff --git a/cli/tools/jupyter/jupyter_msg.rs b/cli/tools/jupyter/jupyter_msg.rs index c28dd3b48..beb9f34e4 100644 --- a/cli/tools/jupyter/jupyter_msg.rs +++ b/cli/tools/jupyter/jupyter_msg.rs @@ -206,6 +206,14 @@ impl JupyterMessage { self } + pub(crate) fn with_metadata( + mut self, + metadata: serde_json::Value, + ) -> JupyterMessage { + self.metadata = metadata; + self + } + pub(crate) async fn send( &self, connection: &mut Connection, -- cgit v1.2.3