web_debug

command
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 14 Imported by: 0

README

RPC Web Debug Example

This example runs a small web app that calls go-command/rpc methods from the browser and shows raw request/response payloads in a debug panel.

What it demonstrates

  • Endpoint-provider registration through command.Registry + rpc.Resolver
  • RPC methods declared with explicit endpoint specs (rpc.NewEndpoint)
  • A tiny HTTP JSON-RPC adapter using rpc.Server.NewRequestForMethod + rpc.Server.Invoke
  • Browser-side debug panel with full request/response history

Registered methods:

  • counter.increment (execute)
  • counter.reset (execute)
  • counter.snapshot (query)

Run

From repository root:

go run ./examples/rpc/web_debug

Open http://localhost:8091.

JSON-RPC shape used by the demo

{
  "jsonrpc": "2.0",
  "id": "req-1",
  "method": "counter.increment",
  "params": {
    "data": {
      "amount": 3
    },
    "meta": {
      "actorId": "demo-user",
      "requestId": "req-1"
    }
  }
}

Response examples:

  • execute methods return "result": null
  • query methods return "result": {"data": ...}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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