diff options
author | Trevor Manz <trevor.j.manz@gmail.com> | 2023-10-04 07:05:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 13:05:20 +0200 |
commit | 9a46a824bd897e240af8a14f9d950ab6d95f42a5 (patch) | |
tree | 9c6bf70579452767b194112d6a531c14feec5652 /cli/tests/testdata/jupyter/integration_test.ipynb | |
parent | da0b945804f19903beac71b23ff1040ebdb9b554 (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/tests/testdata/jupyter/integration_test.ipynb')
-rw-r--r-- | cli/tests/testdata/jupyter/integration_test.ipynb | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/cli/tests/testdata/jupyter/integration_test.ipynb b/cli/tests/testdata/jupyter/integration_test.ipynb index 76064cea2..450df4e9e 100644 --- a/cli/tests/testdata/jupyter/integration_test.ipynb +++ b/cli/tests/testdata/jupyter/integration_test.ipynb @@ -721,8 +721,47 @@ }, { "cell_type": "code", + "execution_count": 22, + "id": "6e9b530f-554d-4ef7-a5d6-69432283fd40", + "metadata": {}, + "outputs": [], + "source": [ + "// Smoke test: Send example Jupyter Widgets messages with \"extra\" context.\n", + "// No return because we don't have a front-end widget to get the message from.\n", + "await Deno.jupyter.broadcast(\n", + " \"comm_open\",\n", + " {\n", + " \"comm_id\": \"foo\",\n", + " \"target_name\": \"jupyter.widget\",\n", + " \"data\": {\n", + " \"state\": {},\n", + " },\n", + " },\n", + " {\n", + " \"metadata\": { \"version\": \"2.1.0\" },\n", + " },\n", + ");\n", + "\n", + "await Deno.jupyter.broadcast(\n", + " \"comm_msg\",\n", + " {\n", + " \"comm_id\": \"foo\",\n", + " \"data\": {\n", + " \"method\": \"update\",\n", + " \"state\": { \"answer\": null },\n", + " \"buffer_paths\": [[\"answer\"]]\n", + " },\n", + " },\n", + " {\n", + " \"buffers\": [new Uint8Array([42])],\n", + " },\n", + ");" + ] + }, + { + "cell_type": "code", "execution_count": null, - "id": "0181f28e", + "id": "f678313e-06c6-4fb8-a4ef-54a417129a82", "metadata": {}, "outputs": [], "source": [] |