Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) Register(cid string)
- func (c *Client) Request(recipients []string, cid string, mtype string, data []byte, ...) (string, []byte, error)
- func (c *Client) Send(recipients []string, mtype string, plaintext []byte) error
- func (c *Client) SendAsync(recipients []string, mtype string, plaintext []byte, callback func(error))
- func (c *Client) Start() bool
- func (c *Client) Subscribe(msgType string, sub func(sender string, payload []byte))
- func (c *Client) Wait(cid string, timeout time.Duration) (string, []byte, error)
- type Config
- type Storage
- type Transport
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 default implementation of a messaging client
func (*Client) Request ¶
func (c *Client) Request(recipients []string, cid string, mtype string, data []byte, timeout time.Duration) (string, []byte, error)
Request sends a request to a specified identity and blocks until response is received
func (*Client) SendAsync ¶
func (c *Client) SendAsync(recipients []string, mtype string, plaintext []byte, callback func(error))
SendAsync sends an encypted message to recipients asynchromously, returning the servers response via the provided callback
type Config ¶
type Config struct { SelfID string DeviceID string KeyID string PrivateKey ed25519.PrivateKey MessagingURL string APIURL string Transport Transport Storage Storage }
Config messaging configuration for connecting to self messaging
type Storage ¶
type Storage interface { AccountOffset(inboxID string) (int64, error) Encrypt(from string, to []string, plaintext []byte) ([]byte, error) Decrypt(from, to string, offset int64, ciphertext []byte) ([]byte, error) }
Storage the storage provider used to encrypt and decrypt messages
type Transport ¶
type Transport interface { Send(recipients []string, mtype string, priority int, data []byte) error SendAsync(recipients []string, mtype string, priority int, data []byte, callback func(err error)) Receive() ([]byte, string, int64, []byte, error) Close() error }
Transport the stateful connection used to send and receive messages
Click to show internal directories.
Click to hide internal directories.