dom icon indicating copy to clipboard operation
dom copied to clipboard

GRPC over WebRTC using WASM

Open ghost opened this issue 7 years ago • 4 comments

there is a pure webrtc golang impl here:https://github.com/pions/webrtc

SO i was thinking its maybe possible to do GRPC over Webrtc. This could then allow p2p style architecture. it woudl be usable for server to server and server to browser, Or server to desktop client. So sort of one network transport for everything and GRPC for everything.

what do you think ? I am not sure it will work but its a metetr of trying i suspect.

BTW was very easy to get going and everything works immediatly. I make it all into a Makefile so no reliance on bash files:

LIB=github.com/dennwc/dom
LIB_FSPATH=${GOPATH}/src/$(LIB)

WASM_FILES="$(GOROOT)/misc/wasm"

GRPC=${LIB_FSPATH}/examples/grpc-over-ws

dep:
	go get -u github.com/dennwc/dom
	go install github.com/dennwc/dom/cmd/wasm-server

open:
	code ${LIB_FSPATH}

##


run:
	cd ${GOPATH}/src/github.com/dennwc/dom && wasm-server

run-ex-grpc:
	cd $(GRPC) && GOOS=js GOARCH=wasm go build -o client.wasm ./client.go
	cd $(GRPC) && cp ${WASM_FILES}/wasm_exec.js ./
	cd $(GRPC) && go run ./server.go

ghost avatar Nov 08 '18 05:11 ghost

Yes, I have plans to finish the WebRTC for WASM as soon as synchronous callbacks CL is merged.

Similar to the WebSocket API in this project, I planned to expose a single API that will use the project you mentioned on the host, and JS implementation in the browser (using build tags).

So definitely worth exploring :)

dennwc avatar Nov 08 '18 12:11 dennwc

wow thats an amazing co-incidence. Sort of on the same path !

Yep thats exactly the approch i was thinking with the golang webrtc on the server. For Fat Clients ( Desktop and Mobile), we can use webrtc golang there.

ghost avatar Nov 08 '18 12:11 ghost

wow thats an amazing co-incidence. Sort of on the same path !

Yep thats exactly the approch i was thinking with the golang webrtc on the server. For Fat Clients ( Desktop and Mobile), we can use webrtc golang there.

Do you have a sample of using pion-webrtc on the server and grow on the client?

dtel avatar Apr 17 '19 17:04 dtel

I think it was nice as an experiment for this package, but pion-webrtc now supports wasm natively. They've done a great job, So I will probably remove the example completely, or will just leave a gRPC signaling and use their library.

dennwc avatar Apr 17 '19 17:04 dennwc