hobby-rpc

Version, currently main branch1 version
  • main branchlatestAug 13, 2026

github.com/ch1c0t/crystal.hobby-rpc.client

A Hobby-RPC client for Crystal

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  hobby-rpc:
    github: ch1c0t/crystal.hobby-rpc.client
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 1.21.0
License
MIT
Author
Anatoly Chernov

Dependencies

This version declares no dependencies.

README

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