2017 web RPC

Over the past few days I've been on a mission to rebuild a side project website. I'm a fan of json over websocket as a request/response mechanism and I wanted to take that further (fully realzing that path leads to gRPC, but the browser side is not there yet). Defining a set of possible messages and their attributes using json-schema was always just out of reach of the todo list. I took a look at that now and due to the lack of code generation, I was redirected to protobuf. I can remember being excited about protobuf3's json representation a year ago.

The setup for this project is elm on the client side, and go on the server side. Using protobuf message definitions, the format of messages can be specified and code generated for each language. Errors such as the wrong kind of value or missing fields will be caught at compile time, assuming client and server are using the same set of proto files.

There is a protoc code generator plugin for both go and elm.