storj / drpc

drpc is a lightweight, drop-in replacement for gRPC
MIT License
1.48k stars 49 forks source link

WASM support? #5

Open tmc opened 3 years ago

tmc commented 3 years ago

Is it in the cards to have a web socket-based transport for use with WASM projects?

zeebo commented 3 years ago

This should be possible. One would just need to write something that maps an incoming websocket to a stream, and then pass that into a handler.

Do you have a Go websocket library you prefer?

tmc commented 3 years ago

Yes, https://github.com/gorilla/websocket

zeebo commented 3 years ago

I made demo implementations using gorilla/websocket and gobwas/ws and put them in this gist: https://gist.github.com/zeebo/ae635824205088a51031c09cb07ea553

The gobwas/ws code is both a client and a server, and the gorilla/websocket code is just server (but should be able to extend to clients in the same way).

Hopefully they can be used as a starting point for someone (or myself) to pick up. :smile:

zeebo commented 3 years ago

https://pkg.go.dev/go.bryk.io/pkg/net/drpc/ws is an external websocket based transport to look at as well.

gedw99 commented 3 years ago

https://github.com/lightninglabs/falafel is able to use WASM, and InProcess and traditional GRPC

InProcess support: https://github.com/lightninglabs/falafel#description WASM support : https://github.com/lightninglabs/falafel#generating-jsonwasm-stubs