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

Add new network type "localhub" #1216

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

Conversation

chschnell
Copy link
Contributor

Added a new class LocalhubNetworkAdapter which provides a simple BroadcastChannel-based network to v86 guests.

This networking method allows multiple v86 instances within the same browser process to communicate with each other like in a physical network, but without access to any external networks (it uses the same method as demonstrated in examples/broadcast-network.html).

The URL scheme (for config.net_device.relay_url) of this new networking method is localhub.

Added it to the v86 web interface in main.js because it works out of the box and is a great method to get started with v86 networking.

This PR is only meant to be a proposal, everything is up for debate, if this proposal should get rejected I'd be absolutely fine with the decision, of course.

Copy link
Owner

@copy copy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks useful as a feature for the website. I'm not sure about the name, how about broadcast_channel or browser_tab or similar?

@@ -315,6 +315,10 @@ V86.prototype.continue_init = async function(emulator, options)
{
this.network_adapter = new FetchNetworkAdapter(this.bus, options.net_device);
}
else if(relay_url === "localhub")
{
this.network_adapter = new LocalhubNetworkAdapter(this.bus, options.net_device);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms the v86 API, I'm not too happy about the open-endedness of this network configuration (e.g., what if the user wants to mix this with web workers?). I'd prefer if users of the API used the net0-{send,receive} API instead.

Could you leave a comment here (or above the constructor) saying that this is experiment and might change at any time?

@SuperMaxusa
Copy link
Contributor

Maybe it makes sense to rewrite examples/broadcast-network.html to this network type?

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.

3 participants