Skip to content

Commit

Permalink
Merge pull request #211 from nats-io/advanced_conf_nats_conn
Browse files Browse the repository at this point in the history
[ADDED] Doc about advanced configuration of a connection [ci skip]
  • Loading branch information
kozlovic committed Nov 16, 2018
2 parents db4b9b1 + e8f1500 commit 19c9df8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,27 @@ NATS Streaming subscriptions **do not** support wildcards.

## Advanced Usage

### Connection configuration such as TLS, etc..

If you want more advanced configuration of the underlying NATS Connection, you will need
to create a NATS connection and pass that connection to the `stan.Connect()` call with
the `stan.NatsConn()` option.

```go
// Create a NATS connection that you can configure the way you want
nc, err = nats.Connect("tls://localhost:4443", nats.ClientCert("mycerts/client-cert.pem", "mycerts/client-key.pem"))
if (err != nil)
...

// Then pass it to the stan.Connect() call.
sc, err = stan.Connect("test-cluster", "me", stan.NatsConn(nc))
if (err != nil)
...

// Note that you will be responsible for closing the NATS Connection after the streaming
// connection has been closed.
```

### Connection Status

The fact that the NATS Streaming server and clients are not directly connected poses a challenge when it comes to know if a client is still valid.
Expand Down

0 comments on commit 19c9df8

Please sign in to comment.