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

Ensure binary data is a DataView #152

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]


* Fixed a bug with receiving binary data on the frontend, which gets [quak](https://github.com/manzt/quak) and [mosaic-widget](https://idl.uw.edu/mosaic/jupyter/) working with `@render_widget`. (#152)

## [0.3.2] - 2024-04-16

Expand Down
1 change: 1 addition & 0 deletions js/src/comm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class ShinyComm {
const msg = {
content: {comm_id: this.comm_id, data: data},
metadata: metadata,
// TODO: need to _encode_ any buffers into base64 (JSON.stringify just drops them)
buffers: buffers || [],
// this doesn't seem relevant to the widget?
header: {}
Expand Down
2 changes: 1 addition & 1 deletion js/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { decode } from 'base64-arraybuffer';
// along to the comm logic
function jsonParse(x: string) {
const msg = JSON.parse(x);
msg.buffers = msg.buffers.map((b: any) => decode(b));
msg.buffers = msg.buffers.map((base64: string) => new DataView(decode(base64)));
return msg;
}

Expand Down
Loading