nats
Version, currently main branch1 version
- main branchlatestJan 7, 2022
github.com/nats-io/nats.cr
Crystal client for NATS
47 stars
0 dependents
License: Apache-2.0
Installation
# Add this to your shard.yml
dependencies:
nats:
github: nats-io/nats.cr
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.30, < 2.0- License
- Apache-2.0
- Author
- Derek Collison <derek@nats.io>
- Targets
nats-pubfrom bin/nats-pub.crnats-reqfrom bin/nats-req.crnats-subfrom bin/nats-sub.cr
Dependencies
This version declares no dependencies.
README
# NATS - Crystal Client
Simple NATS client for the [Crystal](https://crystal-lang.org) programming language.
[](https://www.apache.org/licenses/LICENSE-2.0)
[](http://travis-ci.org/nats-io/nats.cr)
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
nats:
github: nats-io/nats.cr
```
2. Run `shards install`
## Usage
```crystal
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.close
```
## License
Unless otherwise noted, the NATS source files are distributed under
the Apache Version 2.0 license found in the LICENSE file.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jan 7, 2022
- Crystal
>= 1.30, < 2.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/nats-io/nats.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1