1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

GitBook: [master] 82 pages modified

This commit is contained in:
Ginger Collison
2019-12-18 22:09:45 +00:00
committed by gitbook-bot
parent 7e27f03c98
commit b082996143
71 changed files with 865 additions and 930 deletions

View File

@@ -24,7 +24,7 @@ servers := []string{"nats://127.0.0.1:1222", "nats://127.0.0.1:1223", "nats://12
nc, err := nats.Connect(strings.Join(servers, ","))
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()

View File

@@ -7,7 +7,7 @@ Each library has its own, language preferred way, to pass connection options. On
```go
nc, err := nats.Connect("demo.nats.io", nats.Name("API Options Example"), nats.Timeout(10*time.Second))
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()

View File

@@ -7,7 +7,7 @@ Some libraries also provide a special way to connect to a _default_ url, which i
```go
nc, err := nats.Connect(nats.DefaultURL)
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()

View File

@@ -14,7 +14,7 @@ Keep in mind that each connection will have to turn off echo, and that it is per
// Turn off echo
nc, err := nats.Connect("demo.nats.io", nats.Name("API NoEcho Example"), nats.NoEcho())
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()

View File

@@ -14,7 +14,7 @@ If you have a connection that is going to be open a long time with few messages
// Set Ping Interval to 20 seconds
nc, err := nats.Connect("demo.nats.io", nats.Name("API Ping Example"), nats.PingInterval(20*time.Second))
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()
@@ -99,14 +99,14 @@ For example, to set the maximum number of outgoing pings to 5:
{% tab title="Go" %}
```go
// Set maximum number of PINGs out without getting a PONG back
// before the connection will be disconnected as a stale connection.
nc, err := nats.Connect("demo.nats.io", nats.Name("API MaxPing Example"), nats.MaxPingsOutstanding(5))
if err != nil {
log.Fatal(err)
}
defer nc.Close()
// before the connection will be disconnected as a stale connection.
nc, err := nats.Connect("demo.nats.io", nats.Name("API MaxPing Example"), nats.MaxPingsOutstanding(5))
if err != nil {
log.Fatal(err)
}
defer nc.Close()
// Do something with the connection
// Do something with the connection
```
{% endtab %}

View File

@@ -67,7 +67,7 @@ While the client can't control the maximum payload size, clients may provide a w
```go
nc, err := nats.Connect("demo.nats.io")
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()
@@ -160,7 +160,7 @@ opts.Url = "demo.nats.io"
opts.Pedantic = true
nc, err := opts.Connect()
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()
@@ -245,7 +245,7 @@ opts.Url = "demo.nats.io"
opts.Verbose = true
nc, err := opts.Connect()
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()

View File

@@ -15,7 +15,7 @@ For example, to connect to the demo server with a URL you can use:
// nats.Connect("nats://demo.nats.io:4222")
nc, err := nats.Connect("demo.nats.io")
if err != nil {
log.Fatal(err)
log.Fatal(err)
}
defer nc.Close()