client

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DefaultReconnectInterval ...
	DefaultReconnectInterval = 2

	// DefaultMaxReconnectInterval ...
	DefaultMaxReconnectInterval = 64

	// DefaultPingInterval is the default time interval (in seconds) between pings
	DefaultPingInterval = 60
)

Variables

View Source
var (
	ErrConnectionFailed = errors.New("error: connection failed")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient(url string, options *Options) *Client

NewClient ...

func (*Client) Publish

func (c *Client) Publish(topic, message string) error

Publish ...

func (*Client) Pull

func (c *Client) Pull(topic string) (msg *msgbus.Message, err error)

Pull ...

func (*Client) Subscribe

func (c *Client) Subscribe(topic string, index int64, handler msgbus.HandlerFunc) *Subscriber

Subscribe ...

type Options

type Options struct {
	PingInterval         int
	ReconnectInterval    int
	MaxReconnectInterval int
}

Options ...

type Subscriber

type Subscriber struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Subscriber ...

func NewSubscriber

func NewSubscriber(client *Client, topic string, index int64, handler msgbus.HandlerFunc) *Subscriber

NewSubscriber ...

func (*Subscriber) Run added in v0.1.18

func (s *Subscriber) Run(ctx context.Context) error

Run runs the subscriber client with the provided context

Jump to

Keyboard shortcuts

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