Today, I'm going introduce one of my recent practices to build realtime web app which can then be compiled into a single binary for deployment with zero external dependencies.
The stack I'm using is a mix of the following technologies:
Flutter was born to be a frontend UI framework for mobile devices. Recently it has been ported to web and desktop platforms, although still in alpha stage. But the code quality is quite high, IDE experience is pretty good, I would like to give it a try.
gRPC is a library from Google, and it supports streaming, which can be used to implement realtime applications.
But gRPC speaks
http/2 protocol itself, and not all browsers support this protocol currently. To fill the gap between JS and gRPC world, engineers of gRPC team developed an adapter layer, which could be found at:
But this requires to setup an
envoy proxy in front of the plain gRPC service, which I don't like.
Fortunately, engineers at
improbable-eng have developed an golang library which communicates in
grpc-web protocol. The link is
Finally, we are going to embed these static frontend assets into our golang binary, so that we can deploy our program without any depencies.
The tool I'm using is
github.com/markbates/pkger, which will search in the golang code for any static file references and package the into a file named
pkged.go, then we can use our existing golang toolchain to generate final binary for any platform.
Details and example source code
Will post the sample source code later.
TO BE CONTINUTED...