Documentation ¶
Overview ¶
Package nats provides Gobot adaptor for the nats message service. Installing:
go get gobot.io/x/gobot/platforms/nats
For further information refer to mqtt README: https://gobot.io/x/gobot/blob/master/platforms/nats/README.md
Index ¶
- type Adaptor
- func (a *Adaptor) Connect() (err error)
- func (a *Adaptor) Disconnect() (err error)
- func (a *Adaptor) Finalize() (err error)
- func (a *Adaptor) Name() string
- func (a *Adaptor) On(event string, f func(s []byte)) bool
- func (a *Adaptor) Publish(topic string, message []byte) bool
- func (a *Adaptor) SetName(n string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶ added in v1.0.0
type Adaptor struct { Host string // contains filtered or unexported fields }
Adaptor is a configuration struct for interacting with a NATS server. Name is a logical name for the adaptor/nats server connection. Host is in the form "localhost:4222" which is the hostname/ip and port of the nats server. ClientID is a unique identifier integer that specifies the identity of the client.
func NewAdaptor ¶ added in v1.0.0
NewAdaptor populates a new NATS Adaptor.
func NewAdaptorWithAuth ¶ added in v1.0.0
NewAdaptorWithAuth populates a NATS Adaptor including username and password.
func (*Adaptor) Disconnect ¶ added in v1.0.0
Disconnect from the nats server.
func (*Adaptor) On ¶ added in v1.0.0
On is an event-handler style subscriber to a particular topic (named event). Supply a handler function to use the bytes returned by the server.