Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cirocosta/sample-rpc-go

An Example of Go RPC Client and Server
https://github.com/cirocosta/sample-rpc-go

go golang networking rpc

Last synced: about 4 hours ago
JSON representation

An Example of Go RPC Client and Server

Awesome Lists containing this project

README

        

DESCRIPTION

sample-rpc-go provides an example of a client-server
communication making use of `net/rpc` and `net/rpc/jsonrpc`.

Both client and server are meant to be run using a single
binary - to run a server, turn the `-server` flag on:

./main -server

There are three modes supported:

- default: binary RPC (encoding/gob) via pure TCP
- http: binary RPC (encoding/god) via HTTP
- json: JSON-RPC (1.0) via TCP

These modes are meant to be used together (server and client should
be on the same mode) and can be activated with the respective flags.

USAGE

./main --help
Usage of ./main:
-http
whether it should use HTTP
-json
whether it should use json-rpc
-port uint
port to listen or connect to for rpc calls (default 1337)
-server
activates server mode

HACK

# Produce a binary called `main` in the repository root
make build

# Format
make fmt