Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

Commit

Permalink
Added Drain for connection [ci skip]
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Aug 13, 2018
1 parent d5ad590 commit 84e3b98
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -19,6 +19,7 @@ go get github.com/nats-io/gnatsd

```go

// Connect to a server
nc, _ := nats.Connect(nats.DefaultURL)

// Simple Publisher
Expand Down Expand Up @@ -52,9 +53,12 @@ nc.Subscribe("help", func(m *Msg) {
nc.Publish(m.Reply, []byte("I can help!"))
})

// Drain connection (Preferred for responders)
// Close() not needed if this is called.
nc.Drain()

// Close connection
nc, _ := nats.Connect("nats://localhost:4222")
nc.Close();
nc.Close()
```

## Encoded Connections
Expand Down

0 comments on commit 84e3b98

Please sign in to comment.