chr15m / bugout

Back end web app services over WebRTC.
https://chr15m.github.io/bugout
MIT License
607 stars 59 forks source link

Example for stream responses #20

Closed KrishnaPG closed 4 years ago

KrishnaPG commented 4 years ago

This looks good, in the sense it fills the RPC gap in the P2P scenarios. Came across this while searching for a similar requirement.

One request: unable to find how to use this for a scenario where the client makes a request that returns not a single message but, say a stream. Since there is webRTC/webTorrent underlying there somewhere this should be possible. But not sure how to achieve it.

WebTorrent serves static content. Think of it as first-generation websites serving static HTML pages. RPC on WT allows us to essentially have a dynamic content serving (similar to the ASP.net, JSP revolution in the old days) that is distributed.

If only you could kindly showcase some way of achieving: a request, and returning a stream in response, it would be a great help.

For example, rpc fibonacci(5, 585) call returning a stream of fibonacci numbers between 5 and 585 with the ability to pause / cancel

Or a simple data stream, audio / video, screen content etc. in the style of webRTC

chr15m commented 4 years ago

@KrishnaPG the RPC mechanism currently does not support this. You could submit a PR to add it and I"ll take a look. An alternative is to access the underlying WebRTC data channel (simple-peer) which should be a property of the wires.