Documentation ¶
Index ¶
- Variables
- type CLBOptions
- type CLBUser
- func (u *CLBUser) Connect() (err error)
- func (u *CLBUser) Disconnect() (err error)
- func (u *CLBUser) GetExitCh() chan struct{}
- func (u *CLBUser) IsConnected() (ok bool)
- func (u *CLBUser) IsRunning() (ok bool)
- func (u *CLBUser) SetConnected(b bool)
- func (u *CLBUser) SetRunning(b bool)
- func (u *CLBUser) Setup() error
- type Client
- func (c *Client) AddTopic(topic string)
- func (c *Client) Connected(opts protobase.OptionInterface) bool
- func (c *Client) Disconnected(opts protobase.OptCode)
- func (c *Client) GetCreds() protobase.CredentialsInterface
- func (c *Client) GetIdentifier() string
- func (c *Client) GetTopics() []string
- func (c *Client) GetUser() interface{}
- func (c *Client) Publish(msg protobase.MsgInterface)
- func (c *Client) SetAuthMechanism()
- func (c *Client) SetCreds(creds protobase.CredentialsInterface)
- func (c *Client) SetServer(server protobase.ServerInterface)
- func (c *Client) SetUser(user interface{})
- func (c *Client) Setup() error
- func (c *Client) Subscribe(msg protobase.MsgInterface)
- type ClientErrorHandlerFunc
Constants ¶
This section is empty.
Variables ¶
var ( // TODO // . add individual error messages for each option CLBUserInvalid error = errors.New("CLBUser: invalid.") EDENYCONNECT error = errors.New("CLBUser: deny connecting to already connected instance.") EDENYDISCONNECT error = errors.New("CLBUser: deny disconnecting the already disconnected instance.") )
Error messages
Functions ¶
This section is empty.
Types ¶
type CLBOptions ¶
type CLBOptions struct { // TODO: // . check padding ClientDelegate func() protobase.ClientInterface StorageDelegate protobase.MessageBox Conn protobase.ProtoClientConnection CFCallback func(*CLBUser) Addr string MaxRetry int HeartBeat int MinSecMRS int // minimum retry delay ( number in Milliseconds) SecMRS int // maximum sleep duration }
CLBOptions contains values for setting up client-broker connection.
type CLBUser ¶
type CLBUser struct { // TODO: // . check padding sync.RWMutex Conn protobase.ProtoClientConnection // connection handler Cl protobase.ClientInterface // associated client Storage protobase.MessageBox // message storage Exch chan struct{} // exit channel CFCallback func(*CLBUser) Addr string SecMRS int MinSecMRS int MaxRetry int HeartBeat int Running bool Connected bool // contains filtered or unexported fields }
CLBUser implements client to broker connection. It uses 'protobase.ClientInterface' as interface responsible for high level interactions.
func NewCLBUser ¶
func NewCLBUser(opts CLBOptions) (clbu *CLBUser, ok bool)
NewCLBUser validates 'opts' and constructs a new 'CLBUser' and returns a pointer to it with boolean value indicating validity of 'opts'. NOTE: discard boolean iff valid pointer is non-nil.
func (*CLBUser) Connect ¶
Connect establishes connection to the destination and handles reconnecting and retrying to the root destination based on setup options.
func (*CLBUser) Disconnect ¶
Disconnect terminates the connection of the running instance and invokes 'Disconnected' receiver method on the associated client. NOTE: do not call this method manually.
func (*CLBUser) GetExitCh ¶
func (u *CLBUser) GetExitCh() chan struct{}
GetExitCh returns exit channel.
func (*CLBUser) IsConnected ¶
IsConnected returns whether instance is connected.
func (*CLBUser) SetConnected ¶
SetConnected sets 'b' indicating connection status.
func (*CLBUser) SetRunning ¶
SetRunning sets running status to 'b'.
type Client ¶
type Client struct { *sync.RWMutex User interface{} ClientId string Username string Password string WillMessage string WillQos string WillRetain string Server protobase.ServerInterface Topics []string // contains filtered or unexported fields }
Client implements basic high-level functionality based on 'protobase.ClientInterface'.
func (*Client) Disconnected ¶
func (*Client) GetCreds ¶
func (c *Client) GetCreds() protobase.CredentialsInterface
func (*Client) GetIdentifier ¶
func (*Client) Publish ¶
func (c *Client) Publish(msg protobase.MsgInterface)
func (*Client) SetAuthMechanism ¶
func (c *Client) SetAuthMechanism()
func (*Client) SetCreds ¶
func (c *Client) SetCreds(creds protobase.CredentialsInterface)
func (*Client) SetServer ¶
func (c *Client) SetServer(server protobase.ServerInterface)
func (*Client) Subscribe ¶
func (c *Client) Subscribe(msg protobase.MsgInterface)
type ClientErrorHandlerFunc ¶
type ClientErrorHandlerFunc func(client *protobase.ClientInterface)
ClientErrorHandlerFunc is error callback function.