natsbroker

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package natsbroker defines custom Nats Broker for Centrifuge library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL          string
	Prefix       string
	DialTimeout  time.Duration
	WriteTimeout time.Duration
}

Config of NatsBroker.

type NatsBroker

type NatsBroker struct {
	// contains filtered or unexported fields
}

NatsBroker is a broker on top of Nats messaging system.

func New

func New(n *centrifuge.Node, conf Config) (*NatsBroker, error)

New creates NatsBroker.

func (*NatsBroker) Channels

func (b *NatsBroker) Channels() ([]string, error)

Channels - see Broker interface description.

func (*NatsBroker) Close

func (b *NatsBroker) Close(_ context.Context) error

Close is not implemented.

func (*NatsBroker) History

History ...

func (*NatsBroker) Publish

Publish - see Broker interface description.

func (*NatsBroker) PublishControl

func (b *NatsBroker) PublishControl(data []byte, nodeID, _ string) error

PublishControl - see Broker interface description.

func (*NatsBroker) PublishJoin

func (b *NatsBroker) PublishJoin(ch string, info *centrifuge.ClientInfo) error

PublishJoin - see Broker interface description.

func (*NatsBroker) PublishLeave

func (b *NatsBroker) PublishLeave(ch string, info *centrifuge.ClientInfo) error

PublishLeave - see Broker interface description.

func (*NatsBroker) RemoveHistory

func (b *NatsBroker) RemoveHistory(_ string) error

RemoveHistory ...

func (*NatsBroker) Run

Run runs engine after node initialized.

func (*NatsBroker) Subscribe

func (b *NatsBroker) Subscribe(ch string) error

Subscribe - see Broker interface description.

func (*NatsBroker) Unsubscribe

func (b *NatsBroker) Unsubscribe(ch string) error

Unsubscribe - see Broker interface description.

Jump to

Keyboard shortcuts

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