zenoh icon indicating copy to clipboard operation
zenoh copied to clipboard

Question: zenoh for browser-to-browser p2p applications

Open thankrandomness opened this issue 4 years ago • 5 comments

Hi! Has anyone used zenoh to build a browser-to-browser p2p application? Any references to such examples would be great. Thanks!

thankrandomness avatar Jun 22 '21 01:06 thankrandomness

Hello @thankrandomness, not that I know. That should be however straight-forward if you were able to run a zenoh router along with your browser. The idea would be that the browser would use the REST API communicate with the local router, but then the machine to machine communication would be through zenoh. For subscription please keep in mind that zenoh supports SSE. I've never tried it myself, but would be an interesting exercice. If you get to give it a try let me know if you have any issues... And if it works, please also let me know ;-)

kydos avatar Jun 23 '21 08:06 kydos

Thanks for your reply, @kydos! I think that's a big if to me! The constraint in my case is I have to run the router from within the browser. I can only think of using the rustwasm toolchain and generate wasm module for the router and embed it into the javascript app to run in the browser! I am fairly new to the rust and also the wasm ecosystem, but I am excited to get started in this direction! However, if you think this wouldn't work, please let me know and it'd be great if you could think of any other approaches we could discuss!

thankrandomness avatar Jun 23 '21 12:06 thankrandomness

Hi @thankrandomness, If you can afford to deploy a zenoh router outside your browser, here is an example on how you can already do a simple browser-to-browser chat (with the router as an intermediate): https://gist.github.com/JEnoch/5bea39872e361737b5c34e47e4b035b8 To test it, just run zenohd (master branch version) on your localhost (or any other host, just changing the URL in the HTML form).

JEnoch avatar Jun 24 '21 07:06 JEnoch

Would it be possible to run a Zenoh router in a browser with the new Streams API? https://github.com/MattiasBuelens/wasm-streams

carlbean avatar Jul 22 '21 09:07 carlbean

If I may speculate, I think WebRTC could be an applicable technology for browser-to-browser communication. However, I think there still needs to be some sort of router to facilitate peer discovery and signaling...

allsey87 avatar Nov 14 '22 16:11 allsey87