
Show HN: gRPC over WebRTC - jsmouret
https://github.com/jsmouret/grpc-over-webrtc
======
jsmouret
The idea started from a long running discussion about adding support for
bidirectional streaming to grpc-web ( [https://github.com/grpc/grpc-
web/issues/24](https://github.com/grpc/grpc-web/issues/24) )

While Improbable already has a solution using Websocket, WebRTC can bring UDP,
peer to peer and NAT traversal for free, which can be really cool.

I hope this proof of concept inspires a proper production implementation :)

~~~
Matthias247
The whole streaming gRPC for browsers story is indeed a rather interesting
(and sad) one. Around 4 years ago this seem to just have been blocked on the
browsers missing some APIs for streaming HTTP bodies instead of waiting for
the whole response to complete.

The situation there still doesn't have changed if I read that thread correctly
- but instead of adding those APIs there is now talk about using completely
different technologies and yet another set of non-available APIs? That doesn't
make a lot of sense to me.

And while WebRTC (or using a not-yet-specified protocol on top of QUIC) might
be rather cool POCs, those throw a lot of complexity at a workaround for a
problem which seems to have a far easier solution (get the required APIs
implemented).

------
d1plo1d
Very cool to see more people experimenting in this area. I've similarly
implemented GraphQL over WebRTC for [https://tegapp.io/](https://tegapp.io/)
and had great initial success 3D printing over data channels.

One thing I didn't immediately see in this code (excuse me if I just missed it
- this was a quick read through) is a chunking mechanism to limit data channel
messages to their 2^16 byte maximum. If your looking for a drop in solution
saltryrtc has something you might be able to use:
[https://github.com/saltyrtc/chunked-dc-
js](https://github.com/saltyrtc/chunked-dc-js)

GRPC and similarly GraphQL over WebRTC gets you a long ways towards
controlling local servers over the net however the problem of how to handle
signalling in a way that works both online and offline is still a big hurdle.
Personally, I'm pretty excited to see where these WebRTC servers can go with
DAT and IPFS decentralized signalling solutions.

Thanks again for sharing. Great project!

~~~
jsmouret
You're right, there is no chunking... yet :) Thanks for the links

------
Sean-Der
Fantastic work jsmouret!

I am honestly no as familiar with gRPC as I should be (life is all about
WebRTC/P2P Media for me). I am really excited about the NAT traversal/P2P
opportunities this opens up.

It seems super powerful that you could have two services with different
regions/DC/providers talk to each other. With neither even having public IPs!
You don't have to worry about Load Balancers and really could reduce
complexity/security concerns.

------
hellofunk
According to the GRPC website, the technology is completely tied to protocol
buffers? Seems like an odd and specific dependency to have for something like
that: [https://grpc.io/](https://grpc.io/)

~~~
mhaberl
Not really. Take a look here: [https://grpc.io/blog/grpc-with-
json/](https://grpc.io/blog/grpc-with-json/)

------
embiggenerd
I was wondering about this myself. Someone mentioned grpc is not for video, so
kinda gave up.

------
blader_johny
flatend has bi-directional rpc enabled:
[https://github.com/lithdew/flatend](https://github.com/lithdew/flatend)

Can stream large files too!

------
rad_gruchalski
Wow, this is great. Have been considering something similar only this week.

