json_rpc v1.0.0
JSON-RPC Client and Server 
Use and provide services using JSON-RPC!
Transports
| Transport | Client | Server | 
|---|---|---|
| HTTP | Yes | Planned | 
| Websocket | Yes | Planned | 
| TCP | Yes | Yes | 
Custom transports can be easily created.  Have a look at JsonRpc::TcpClient.
Features
- Multi-transport
 - Doesn't require trailing new-line after JSON documents
 - Lenient towards non-conform implementations
 - Built-in protection
- Flood-protection
 - Against huge documents
 - Configurable!
 
 
Usage
Here's a quick HTTP client getting your bitcoin testnet wallets balance:
# Sample code for Bitcoin RPC:
require "json_rpc"
# Set up the HTTP client
http_client = HTTP::Client.new("localhost", 18332)
http_client.basic_auth "rpc_user", "rpc_password"
# Turn it into a JSON-RPC client
client = JsonRpc::HttpClient.new http_client
# Check your balance!
pp client.call(Float64, "getbalance")
But there's more to find in samples/:
For a simple case, see tcp_client.cr and tcp_server.cr.
If you want to see a full application, have a look at tcp_chat.cr.
Installation
Add this to your application's shard.yml:
dependencies:
  json_rpc:
    github: Papierkorb/json_rpc
Contributing
- Fork it ( https://github.com/Papierkorb/json_rpc/fork )
 - Create your feature branch (git checkout -b my-new-feature)
 - Commit your changes (git commit -am 'Add some feature')
 - Push to the branch (git push origin my-new-feature)
 - Create a new Pull Request
 
Running tests
- Install dependencies: 
shards install - Run them: 
crystal spec 
Contributors
- Papierkorb Stefan Merettig - creator, maintainer
 
Have a nice day!
Connect all the things
Repository
  json_rpc
Owner
  
  Statistic
  - 12
 - 1
 - 1
 - 2
 - 2
 - over 4 years ago
 - June 8, 2017
 
License
  MIT License
Links
  
  Synced at
  Tue, 04 Nov 2025 06:29:10 GMT
Languages