Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months ago
JSON representation
An Example of Go RPC Client and Server
- Host: GitHub
- URL: https://github.com/cirocosta/sample-rpc-go
- Owner: cirocosta
- Created: 2018-02-15T20:25:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-05T14:14:41.000Z (almost 6 years ago)
- Last Synced: 2024-10-04T12:48:40.218Z (4 months ago)
- Topics: go, golang, networking, rpc
- Language: Go
- Homepage: https://ops.tips/gists/example-go-rpc-client-and-server/
- Size: 9.77 KB
- Stars: 27
- Watchers: 2
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.txt
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 TCPThese 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 modeHACK
# Produce a binary called `main` in the repository root
make build# Format
make fmt