From 528fcb6d69364323dd4e3897b0144334104898c0 Mon Sep 17 00:00:00 2001 From: mcriley821 Date: Wed, 29 Apr 2026 02:04:48 -0500 Subject: [PATCH] docs: add comparison table --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 0591a27..3266cf8 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,32 @@ go get github.com/mcriley821/jsonrpc2 | `Handler` | Processes incoming requests. Use `Mux` + `Handle`/`HandleNotification` for typed, per-method dispatch. | | `Error` | A JSON-RPC error object. `NewError` creates one; return it from a handler to send an error response. | +## Comparison + +| Feature | This | [x/exp][xexp] | [jrpc2][jrpc2] | [sourcegraph][sg] | [AdamSLevy][al] | [bubunyo][bu] | +|---------|:----:|:-------------:|:--------------:|:-----------------:|:---------------:|:-------------:| +| Transport agnostic | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | +| Bidirectional async | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | +| Batch requests | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | +| `Conn` passed to handler | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | +| Typed handlers (Go generics) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| Mux / per-method routing | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | +| Replier callback | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| Fallback handler | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| `slog`-compatible logger | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| Nullable params | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| Notification-only handlers | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| Concurrency control | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | + +> This table is a best-effort snapshot and may contain errors or omissions. Library features change over time — consult each project's documentation for the authoritative API. +> Contributions are welcome — open an issue to add a library or correct an entry. + +[xexp]: https://pkg.go.dev/golang.org/x/exp/jsonrpc2 +[jrpc2]: https://github.com/creachadair/jrpc2 +[sg]: https://github.com/sourcegraph/jsonrpc2 +[al]: https://github.com/AdamSLevy/jsonrpc2 +[bu]: https://github.com/bubunyo/go-rpc + ## Examples See [`example_test.go`](./example_test.go) for runnable examples covering the full server-client flow, typed handlers, nullable params, error responses, raw handler registration, and connection lifecycle.