crystal.hobby-rpc.client

A Hobby-RPC client for Crystal

hobby-rpc

A minimal, fast Crystal client for Hobby-RPC, supporting TCP/UDS, auth, and error mapping.

Installation

Add to shard.yml:

dependencies:
  hobby-rpc:
    github: ch1c0t/crystal.hobby-rpc.client

Then run shards install.

Usage

require "hobby-rpc"

# Initialize a `Client` by passing it an `address` and, optionally, an `auth_token` too.
# `address` could point to a TCP or UDS socket.
rpc = HobbyRPC::Client.new("http://127.0.0.1:8080")
rpc = HobbyRPC::Client.new("http://127.0.0.1:8080", auth_token: "SecretToken")
rpc = HobbyRPC::Client.new("/tmp/path/to/rpc.socket")
rpc = HobbyRPC::Client.new("/tmp/path/to/rpc.socket", auth_token: "SecretToken")

# Perform remote calls
begin
  # An example Hash from ./spec/unary_spec.cr
  input = {
    "code" => "answer = 42",
    "bare" => true,
  }

  output = rpc.call("Compile", input)
rescue e : HobbyRPC::Client::Exception
  # Handle exceptions
end

input and output are Crystal objects serializable to and deserializable from JSON.

Development

git clone https://github.com/ch1c0t/crystal.hobby-rpc.client
cd crystal.hobby-rpc.client
shards install
crystal spec
Repository

crystal.hobby-rpc.client

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • about 4 hours ago
  • August 13, 2026
License

MIT License

Links
Synced at

Thu, 13 Aug 2026 21:26:54 GMT

Languages