Skip to content

v2.3.0

Choose a tag to compare

@github-actions github-actions released this 10 Jul 14:13

A large release: performance, four transports, clients, batches, server push, observability, and JSON-RPC 2.0 spec compliance.

Highlights

Performance

  • Inline dispatch — no goroutine + channel + select per request; config moved from RWMutex to an atomic copy-on-write snapshot. Single dispatch 3.7 µs → 1.0 µs, 25 → 18 allocs (Apple M3), faster than a hand-rolled encoding/json dispatcher.
  • DoS-safe batch defaults (DefaultMaxBatchSize = 100, bounded concurrency).

Spec compliance

  • Notifications (execute, no response), raw byte-exact structs.ID (no float64 rounding), -32700 parse errors, per-entry batch decoding, whitespace tolerance.

Server API

  • Middleware (Use), per-method timeouts (WithTimeout), OpenRPC 1.3.2 generation from the introspectable registry, observability hook (SetObserver).

Transports

  • jsonrpchttp (net/http) and jsonrpcws (WebSocket, built on coder/websocket) with server push.
  • Fiber v2/v3 adapters as separate nested modules so Fiber/fasthttp stay out of the core go.mod.

Clients

  • Caller/CallResult[R] and batch CallBatch/BatchResultAs[R] over both HTTP and WebSocket, with id correlation and streamed batch decoding.

json/v2 readiness

  • All generic JSON routes through one internal/codec seam; the switch to encoding/json/v2 (≈ Go 1.27) is a one-file change. Still builds on Go 1.25+ with no build flags — no behavior change.

Install

go get github.com/gumeniukcom/golang-jsonrpc2/v2@v2.3.0

# Fiber adapters (separate modules, released alongside):
go get github.com/gumeniukcom/golang-jsonrpc2/jsonrpcfiber@v0.1.0    # Fiber v2
go get github.com/gumeniukcom/golang-jsonrpc2/jsonrpcfiberv3@v0.1.0  # Fiber v3

Full details in CHANGELOG.md.

Full Changelog: v2.2.0...v2.3.0