Member-only story

What Are RPCs in Golang?

An overview of remote procedure calls in Go

Kingsley Tan
Better Programming
6 min readDec 12, 2019
Photo by Ishan @seefromthesky on Unsplash

What Is an RPC?

A Remote Procedure Call (RPC) is a subroutine in distributed computing. The remote implementation of RPC is similar to local calls but usually not identical. RPC usually requires that the object name, function name, or parameter are passed to remote servers, and the servers then return the processed result(s) back to client-side (request-response). RPC can be communicated through TCP, UDP, or HTTP protocols.

There are three types of implementation in Golang, namely:

  • net/rpc
  • net/rpc/jsonrpc
  • gRPC

net/rpc

The Golang official documentation uses encoding/gob in the net/rpc package as encoding or decoding methods, supporting TCP or HTTP protocols. However, because gob encoding is only used in Golang, it only supports servers and client-side interactions written in Golang.

Example of server-side net/rpc:

package mainimport (   "fmt"

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Kingsley Tan
Kingsley Tan

Written by Kingsley Tan

Crypto Enthusiast | Fintech | Ex-Developer

Responses (1)

What are your thoughts?