pubsub

package
v0.0.0-...-461edb3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomBool

type AtomBool int32

func (*AtomBool) IsTrue

func (b *AtomBool) IsTrue() bool

func (*AtomBool) Set

func (b *AtomBool) Set(value bool)

type Context

type Context struct {
	Config        map[string]string
	InMsgs        chan *server.Msg
	SubToIndex    map[string]int
	Subscriptions []*server.Subscription
	SubChannels   []string
	Client        *server.Conn
	Connected     *AtomBool
	Tick          *server.Msg
}

Context contains the necessary information to run the Nats client

func New

func New(config map[string]string) *Context

func (*Context) Close

func (ctx *Context) Close()

func (*Context) Connect

func (ctx *Context) Connect(username string, register, subscribe []string) error

func (*Context) Payload

func (ctx *Context) Payload(msg *server.Msg) []byte

func (*Context) Publish

func (ctx *Context) Publish(channel string, message []byte) error

func (*Context) PublishStr

func (ctx *Context) PublishStr(channel string, message string) error

func (*Context) PublishTTL

func (ctx *Context) PublishTTL(channel string, message []byte, ttl int) error

func (*Context) PublishTTLStr

func (ctx *Context) PublishTTLStr(channel string, message string, ttl int) error

func (*Context) Register

func (ctx *Context) Register(channel string) error

func (*Context) Subscribe

func (ctx *Context) Subscribe(channel string) (err error)

func (*Context) Topic

func (ctx *Context) Topic(msg *server.Msg) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL