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

wasm: add a close() method #64

Merged
merged 1 commit into from
Jan 28, 2024
Merged

wasm: add a close() method #64

merged 1 commit into from
Jan 28, 2024

Conversation

benma
Copy link
Contributor

@benma benma commented Jan 28, 2024

This closes the connection and calls the onCloseCb callback. The callback is called manually for webHID (the webHID disconnect callback is not fired on close), and automatically for the bridge (the socket onclose event is automatically firex on close).

This allows one to create a short lived connection (release the BitBox02 after performing the desired operation). This is helpful in webclients such as Rabby where one only needs to open a quick connection to e.g. sign a transaction.

This only applies to WASM, not to Rust. In Rust, one can close the connection by simply dropping the object.

This closes the connection and calls the onCloseCb callback. The
callback is called manually for webHID (the webHID disconnect callback
is not fired on close), and automatically for the bridge (the socket
onclose event is automatically firex on close).

This allows one to create a short lived connection (release the
BitBox02 after performing the desired operation). This is helpful in
webclients such as Rabby where one only needs to open a quick
connection to e.g. sign a transaction.

This only applies to WASM, not to Rust. In Rust, one can close the
connection by simply dropping the object.
@benma benma merged commit c0c7ea3 into master Jan 28, 2024
10 checks passed
@benma benma deleted the wasm-close branch January 28, 2024 22:02
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

Successfully merging this pull request may close these issues.

1 participant