Skip to content
Crystal client for NATS
Crystal Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Fix for #5 Sep 11, 2019
docs doc updates Sep 10, 2019
scripts Add in support to download nats-server for tests. Sep 10, 2019
spec Add in support to download nats-server for tests. Sep 10, 2019
src Don't use IO::Memory: use Socket's buffer Sep 10, 2019
.travis.yml Merge pull request #1 from nats-io/travis Sep 10, 2019
LICENSE Update on License to AP2 Sep 10, 2019
README.md
TODO Initial commit Sep 10, 2019
shard.yml Initial commit Sep 10, 2019

README.md

NATS - Crystal Client

Simple NATS client for the Crystal programming language.

License Apache 2 Build Status

Installation

  1. Add the dependency to your shard.yml:
   dependencies:
     nats:
       github: nats-io/nats.cr
  1. Run shards install

Usage

require "nats"

nc = NATS::Connection.new("demo.nats.io")
nc.subscribe("foo") { |msg| puts "Received '#{msg}'"}
nc.publish("foo", "Hello!")

sub = nc.subscribe("req") do |msg|
  msg.respond("ANSWER is 42")
end

answer = nc.request("req", "Help!")
puts "Received a response '#{answer}'!"

sub.close

nc.flush
nc.close

License

Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.

You can’t perform that action at this time.