Liking cljdoc? Tell your friends :D

JSON-RPC 2.0

Unified JSON-RPC 2.0 interface over HTTP[S], WebSocket and UNIX socket for Clojure(Script).

Rationale

Goals

  • [x] Support Clojure.
  • [x] Support HTTP.
  • [x] Future support.
  • [x] Support WebSocket.
  • [x] Support HTTP status override.
  • [x] Support UNIX socket.
  • [ ] Write unit tests.
  • [ ] Support WebSocket Ping/Pong.
  • [ ] Support request batching.
  • [ ] Pluggable HTTP client.
  • [ ] Pluggable WebSocket client.
  • [ ] Pluggable JSON encoder.
  • [ ] Support ClojureScript.
  • [ ] Support JSON-RPC notification.

Usage

Clojars Project

Leiningen/Boot

[com.github.hindol/json-rpc.core "${version}"]

tools.deps.alpha

com.github.hindol/json-rpc.core {:mvn/version "${version}"}

Quickstart

(ns example.core
  (:require [json-rpc.core :as rpc]))

;; Choose from HTTP[S], WebSocket and UNIX socket
(def url "http://localhost:8545")
(def url "ws://localhost:8546")
(def url "unix:///var/run/geth.ipc")

(def connection (rpc/connect url))

;; Receive a future
(rpc/send! connection "eth_blockNumber" ["latest"])

;; Deref to get the response
@(rpc/send! connection "eth_blockNumber" ["latest"])

;; Like send! but accepts a variable number of arguments
@(rpc/send!* connection "eth_blockNumber" "latest")

Component

Mount

Logs

API Documentation

cljdoc badge

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close