Skip to content
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

Support binary data over ShinyComm #151

Open
manzt opened this issue Jul 31, 2024 · 1 comment
Open

Support binary data over ShinyComm #151

manzt opened this issue Jul 31, 2024 · 1 comment

Comments

@manzt
Copy link
Contributor

manzt commented Jul 31, 2024

From manzt/quak#30

Many anywidgets and several traditional Jupyter Widgets rely on Jupyter's support for binary data over the comm.

The message protocol allows sending messages including both JSON serializable and binary blobs together.

Right now buffers is ignored in ShinyComm.send:

buffers: buffers || [],

and on_msg callback should take a second buffers?: Array<ArrayBuffer> argument:

Of course, shiny doesn't need to implement the Jupyter Widgets Protocol... but I wasn't able to figure out how to pack both JSON-serializable & binary blobs together. Maybe msgpack might be of interest, as long as Shiny as way to send a binary input blob.

EDIT: Taking a closer look, shinywidgets does support sending binary data to the front end (although it does so with base64 encoding the data). I've made a PR #152 to ensure the types are what are expected by widgets.

@manzt
Copy link
Contributor Author

manzt commented Jul 31, 2024

It might be useful to throw an error if front-end code tries to ShinyComm.send buffers, since would help end users quickly identify that this is a limitation of shinywidgets support for Jupyter Widgets. That would help avoid end users reporting issues to the widget libraries when buffers are silently deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant