Categorygithub.com/cloudfoundry/yagnats
modulepackage
0.0.0-20210903191155-c3d200e049ee
Repository: https://github.com/cloudfoundry/yagnats.git
Documentation: pkg.go.dev

# README

Build Status

Yet Another Go NATS Client

A simple client for NATS written in Go.

Basic usage:

client := yagnats.NewClient()

err := client.Connect(&yagnats.ConnectionInfo{
		Addr:     "127.0.0.1:4222",
		Username: "user",
		Password: "pass",
})
if err != nil {
  panic("Wrong auth or something.")
}

client.Subscribe("some.subject", func(msg *Message) {
  fmt.Printf("Got message: %s\n", msg.Payload)
})

client.Publish("some.subject", []byte("Sup son?"))

TLS: Add a cert pool to the ConnectionInfo to enable a TLS connection

roots := x509.NewCertPool()
ok := roots.AppendCertsFromPEM([]byte("some-ca-cert-string"))

err := client.Connect(&ConnectionInfo{
        Addr:            "127.0.0.1:4222",
        Username:        "nats",
        Password:        "nats",
        CertPool:        roots,
})

Note: The INFO message is NOT currently available for consumption from the client.

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author