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

Enable wasm32 compilation and runtime of the binary-port-access lib #1

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

gRoussac
Copy link
Contributor

@gRoussac gRoussac commented Oct 21, 2024

As MVP Enable wasm32 compilation and runtime of the nested binary-port-access library.

Basically expose the binary-port-access lib as intended for Rust (non wasm32) / NodeJs (wasm32) / Browser WebSockets (wasm32)

  • Rust remains the same a previous aka a TCP connection
  • In Node.js, it uses raw TCP connections via the net module.
  • In non-Node.js environments (typically browsers), it uses WebSockets.

Note that browsers have CORS (Cross-Origin Resource Sharing) restrictions, so the WebSocket requests should/may be addressed to a WebSocket proxy.

The added communication module provides both shared and platform-specific functionalities for managing communication processes.
- common.rs
- wasm32.rs Contains WebAssembly-specific (wasm32 target) communication utilities, available only when compiled for WebAssembly.

A TODO remains to replace usage of js_sys::eval on Node.js (script is local, not remote so no security issue but nice to change to global function execution with js_sys::Reflect::apply which should be more appropriate)

Could not make it work without eval because net library is required for NodeJs through require

NodeJs

Desktop-screenshot-10-27-2024_06_07_PM

Chromium Browser

Desktop-screenshot-10-27-2024_10_30_PM
Desktop-screenshot-10-27-2024_10_32_PM

@gRoussac gRoussac changed the title Rust sdk feat 2.0 Enable wasm32 compilation and runtime of the binary-port-access lib Oct 28, 2024
@gRoussac gRoussac marked this pull request as ready for review November 1, 2024 13:26
@gRoussac gRoussac requested review from zajko and devendran-m November 1, 2024 13:27
@gRoussac gRoussac requested a review from rafal-ch November 5, 2024 22:56
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