Documentation ¶
Index ¶
- type Client
- func (c *Client) AddStateUpdateListener(handler func(types.LeapStateInfo))
- func (c *Client) ChannelEventChannel() <-chan types.LeapChannelEvent
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) InitEvent() *types.LeapInitEvent
- func (c *Client) MessageEventChannel() <-chan types.LeapMessageEvent
- func (c *Client) State() types.LeapStateInfo
- func (c *Client) Subscribe(channelId string) (*types.ChannelPartial, error)
- type Logger
- type NopLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to define a Leap client. Please use NewClient to create a new client.
func NewClient ¶
NewClient is used to create a new client. If the specified logger is nil, the library will not log any data.
func (*Client) AddStateUpdateListener ¶
func (c *Client) AddStateUpdateListener(handler func(types.LeapStateInfo))
AddStateUpdateListener adds a handler to be called when the state changes.
func (*Client) ChannelEventChannel ¶
func (c *Client) ChannelEventChannel() <-chan types.LeapChannelEvent
ChannelEventChannel is used to get a channel that will receive all channel events. The only exception to this is events that are a reply to functions in this package. Those will be returned from the function.
func (*Client) InitEvent ¶
func (c *Client) InitEvent() *types.LeapInitEvent
InitEvent is used to return the init event. Can be nil if it is not sent.
func (*Client) MessageEventChannel ¶
func (c *Client) MessageEventChannel() <-chan types.LeapMessageEvent
MessageEventChannel is used to get a channel that will receive all message events.
func (*Client) State ¶
func (c *Client) State() types.LeapStateInfo
State returns the state of the websocket.
type Logger ¶
type Logger interface { // Debug is used to log debug information. Debug(message string, metadata map[string]any) // Info is used to log information. Info(message string, metadata map[string]any) // Warn is used to log a warning. Warn(message string, metadata map[string]any) // Error is used to log an error. Note that the error object can be nil and this can just be error data. Error(message string, err error, metadata map[string]any) }
Logger is used to define the interface for a logger. It is un-opinionated, you will probably want to implement this interface for your logging client. By default, this client does not log.