transports

package
v0.0.0-...-147f0cf Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IHubTransport

type IHubTransport interface {

	// AddressTokens returns the address separator and wildcard tokens used by the transport
	//  sep is the address separator. eg "." for nats, "/" for mqtt and redis
	//  wc is the address wildcard. "*" for nats, "+" for mqtt
	//  rem is the address remainder. "" for nats; "#" for mqtt
	AddressTokens() (sep, wc, rem string)

	// ConnectWithPassword connects to the messaging server using password authentication
	//  loginID is the client's ID
	//  password is created when registering the user with the auth service.
	ConnectWithPassword(password string) error

	// ConnectWithToken connects to the messaging server using an authentication token
	// and pub/private keys provided when creating an instance of the hub client.
	//  serializedKP is the key generated with CreateKey.
	//  token is created by the auth service.
	ConnectWithToken(serializedKP string, token string) error

	// CreateKeyPair returns a new set of serialized public/private key pair.
	CreateKeyPair() (serializedKeyPair string, serializedPub string)

	// Disconnect from the message bus
	Disconnect()

	// Pub for publications on any address
	Pub(address string, payload []byte) error

	// PubRequest publishes a RPC request and waits for a response
	PubRequest(address string, payload []byte) (resp []byte, err error)

	// Sub for subscribing to any address.
	Sub(address string, cb func(addr string, data []byte)) (ISubscription, error)

	// SubRequest subscribes to RPC requests and sends the reply to the sender
	SubRequest(address string, handler func(addr string, payload []byte) (
		reply []byte, err error)) (ISubscription, error)
}

IHubTransport defines the interface of the message bus transport used by the hub client.

type ISubscription

type ISubscription interface {
	Unsubscribe() error
}

ISubscription interface to underlying subscription mechanism

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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