Skip to content

kwo/jsonrpc2

 
 

Repository files navigation

jsonrpc2

Package jsonrpc2 is an implementation of the JSON-RPC 2 specification for Go.

Features Comparison

This library is a fork of go.lsp.dev/jsonrpc2, which itself is a cleaned-up fork of x/tools/internal/jsonrpc2. The goal is to provide an importable, stdlib-only JSON-RPC 2 library that cherry-picks the best ideas from the Go team's v2 rewrite without the complexity.

Feature kwo/jsonrpc2 go.lsp.dev/jsonrpc2 x/tools jsonrpc2 (v1) x/tools jsonrpc2_v2
Importable internal internal
Stdlib only (no external deps) segmentio/encoding internal/event
LOC (Go, non-test) 1,460 1,533 1,833 1,859
LSP header framing
Raw JSON framing
Bidirectional Conn
Call / Notify / Response messages
Structured JSON-RPC error codes
Context cancellation
Server idle timeout
Split Reader/Writer interfaces
AsyncCall (non-blocking Call)
Write error propagation
Handler returns (result, error)
Graceful close (drain in-flight)
Server.Shutdown (graceful stop)
CancelHandler
AsyncHandler
StreamServer / Serve / ListenAndServe
Test helpers (TCP + pipe servers)
ReplyHandler (must-reply enforcement)
Binder (per-connection config)
Preempter (pre-queue handling)
ErrAsyncResponse (deferred replies)
IdleListener with finalizers
Built-in event tracing/metrics
Listener/Dialer interfaces

LOC note: counts are approximate Go source lines for each implementation, excluding *_test.go. For x/tools, counts are for the internal/jsonrpc2 and internal/jsonrpc2_v2 directories only.

References

OpenRPC

The OpenRPC Specification defines a standard, programming language-agnostic interface description for JSON-RPC 2.0 APIs.

About

Package jsonrpc2 an implementation of the JSON-RPC 2 specification for Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 99.6%
  • Makefile 0.4%