Documentation ¶
Index ¶
- Constants
- Variables
- func AutoReconnect(enabled bool) func(c *Client) error
- func ReadDeadline(deadline time.Duration) func(c *Client) error
- func ReceiveBuffer(sz int) func(c *Client) error
- func SendBuffer(sz int) func(c *Client) error
- type ACLRule
- type Client
- func (c *Client) BlockSender(selfID string) error
- func (c *Client) Close()
- func (c *Client) IsClosed() bool
- func (c *Client) JWSRegister(id string)
- func (c *Client) JWSRequest(id string, m *msgproto.Message) (chan *msgproto.Message, error)
- func (c *Client) JWSResponse(id string, timeout time.Duration) (*msgproto.Message, error)
- func (c *Client) ListACLRules() ([]ACLRule, error)
- func (c *Client) PermitAll() error
- func (c *Client) PermitSender(selfID string, exp time.Time) error
- func (c *Client) Receive() (*msgproto.Message, error)
- func (c *Client) ReceiveChan() chan *msgproto.Message
- func (c *Client) Send(m *msgproto.Message) error
- type Time
Constants ¶
View Source
const ( DefaultBufferSize = 128 DefaultTimeout = time.Second * 10 DefaultDeadline = time.Second * 10 DefaultRetries = 30 )
Variables ¶
View Source
var ( CloseMessage = websocket.FormatCloseMessage(websocket.CloseNormalClosure, "") TimeFunc = NewTime().Now )
View Source
var NtpServer = "time.google.com"
Functions ¶
func AutoReconnect ¶
AutoReconnect enables retrying a connection if it closes unexpectedly
func ReadDeadline ¶
ReadDeadline sets the tcp read timeout
func ReceiveBuffer ¶
ReceiveBuffer sets the size of the receive buffer
func SendBuffer ¶
SendBuffer sets the size of the send buffer
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client connection for self messaging
func New ¶
func New(endpoint, selfID, deviceID, privateKey string, opts ...func(*Client) error) (*Client, error)
New create a new messaging client
func (*Client) BlockSender ¶
BlockSender blocks messages from a given sender
func (*Client) JWSRegister ¶
JWSRegister registers a jws request by id
func (*Client) JWSRequest ¶
JWSRequest makes a JWS request and returns the response
func (*Client) JWSResponse ¶
JWSResponse waits for a message response for a given JWS request
func (*Client) ListACLRules ¶
ListACLRules returns all active ACL rules for the authenticated identity
func (*Client) PermitSender ¶
PermitSender permits messages from a given sender
func (*Client) ReceiveChan ¶
ReceiveChan returns a channel of all incoming messages
Source Files ¶
Click to show internal directories.
Click to hide internal directories.