inventory/

directory
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: MIT

README

Inventory Example

This example shows the intended GoRPC shape:

  • a server app with request/response types, handler registration, and a main
  • a client app with matching request/response types, synchronous calls, asynchronous callbacks, and a main
  • one long-lived TCP connection carrying typed unary calls
  • automatic client reconnect if that connection drops
  • request metadata available through *gorpc.Context
  • response metadata available through gorpc.ClientContext

The registered function name is just the wire dispatch key; it does not have to match the local Go function name.

Build both commands:

go build ./examples/inventory/server
go build ./examples/inventory/client

Run the server:

go run ./examples/inventory/server

In another terminal, run the client:

go run ./examples/inventory/client

The client fetches widget-001 synchronously, fetches widget-async asynchronously, then intentionally requests missing-item so you can see a structured remote error come back.

Directories

Path Synopsis
Package main runs the GoRPC Inventory example client.
Package main runs the GoRPC Inventory example client.
Package main runs the GoRPC Inventory example server.
Package main runs the GoRPC Inventory example server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL