gRPC in Golang

I’ve been looking at gRPC (http://www.grpc.io/) today to see what it can do for me. It’s a public version of Google’s “Stubby” on which a huge number of internal services are published. I’ve always wanted to deploy an RPC client/server system for home automation and such like (every home device a service, etc). My current idea is to have all the low level hardware interfaces of a Raspberry Pi accessible as a service to get started. It would require:

  • One or more Raspberry Pi’s running some services;
  • The services have local-network discoverable methods, so that anyone can walk into your home with the right application installed, and instantly start controlling your stuff, if that’s what you want;
  • The services should be more event driven than call/response, because in real life you just don’t want to keep polling things to find out when your toast is done.

gRPC looks interesting because there is the concept of streaming clients and streaming servers. So you could open up a channel to listen for that toast popping, and the server will send you a message with the status, then close down the channel (or something).

So to start with, I just wrote the proto-typical “helloworld” example:

https://github.com/djthorpe/grpc/tree/helloworld

I’m impressed with how quickly I can get this up and running (obviously without a great deal of effort beyond cutting and pasting). I think it took me 10 minutes maximum.

In terms of the other features, I couldn’t find anything around service discovery yet, but there’s some sort of link to OpenAPI (https://openapis.org/) which I’ve yet to explore. mDNS shouldn’t be too difficult to implement, so that’s next on the list.