Proposed
The project requires a JSON-RPC server component that can:
The server will be implemented as a pure function that creates a server instance:
(create-server config) -> {:server server-object
                          :stop   (fn [] ...)}
Configuration parameters:
:port - Required. Port number to listen on:handlers - Required. Map of method names to handler functionsHandler function signature:
(handler-fn params) -> edn-response
;; Example handler returning EDN data:
(defn example-handler [params]
  {:result {:status :ok
            :data   [1 2 3]
            :meta   {:timestamp #inst "2024"}}})  ;; EDN data structures
Server will:
Server Management
Request Handling
Error Handling
;; Create server with handlers returning EDN
(def server (create-server
             {:port 8080
              :handlers {"echo" (fn [params]
                                {:result params})  ; EDN map returned
                        "get-config" (fn [params]
                                     {:result {:enabled? true
                                              :features [:a :b :c]
                                              :updated-at #inst "2024"}})}}))
;; Stop server when done
((:stop server))
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |