Skip to content
mcriley821Public

About

Go JSON-RPC 2.0 server/client implementation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

73 Commits

Folders and files

Repository files navigation

jsonrpc2

License: MIT Lint codecov

A Go library implementing JSON-RPC 2.0 over any io.ReadWriteCloser (TCP, Unix socket, stdin/stdout, etc.).

Installation

go get github.com/mcriley821/jsonrpc2

Overview

Concept Description
Stream Wraps an io.ReadWriteCloser with JSON encoding/decoding.
Conn Full-duplex connection. Sends requests (Call/Notify) and dispatches incoming ones to a Handler.
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 jrpc2 sourcegraph AdamSLevy bubunyo
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.

Examples

See example_test.go for runnable examples covering the full server-client flow, typed handlers, nullable params, error responses, raw handler registration, and connection lifecycle.

AI-Assisted Development

This project is developed with AI assistance — not vibe coded. All generated code is reviewed, understood, and tested before being accepted.

About

Go JSON-RPC 2.0 server/client implementation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages