Documentation
¶
Index ¶
- Variables
- type AccessGrant
- type AccessGrantOptions
- type AuthSettings
- type Channel
- type ClientSettings
- type Message
- type PubNubClient
- func (p *PubNubClient) Close()
- func (p *PubNubClient) Grant(a *AuthSettings) error
- func (p *PubNubClient) NewChannel(name string) (*Channel, error)
- func (p *PubNubClient) Push(channelName string, body interface{}) error
- func (p *PubNubClient) SetAuthToken(token string)
- func (p *PubNubClient) Subscribe(channelName string) (*Channel, error)
- type PubNubRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrChannelNotSet = errors.New("channel name is not set") ErrTimeout = errors.New("timeout reached") ErrConnectionAbort = errors.New("connection aborted") ErrConnectionClosed = errors.New("connection closed") )
View Source
var ( ErrRecvMessage = errors.New("message not received") ErrInvalidKey = errors.New("invalid key") )
View Source
var ErrInvalidType = errors.New("invalid type")
Functions ¶
This section is empty.
Types ¶
type AccessGrant ¶
type AccessGrant struct {
// contains filtered or unexported fields
}
func NewAccessGrant ¶
func NewAccessGrant(ao *AccessGrantOptions, cs *ClientSettings) *AccessGrant
func (*AccessGrant) Grant ¶
func (ag *AccessGrant) Grant(as *AuthSettings) error
type AccessGrantOptions ¶
func NewAccessGrantOptions ¶
func NewAccessGrantOptions() *AccessGrantOptions
type AuthSettings ¶
type AuthSettings struct { // PubNub channel name ChannelName string // Grant access for the token. When token is an // empty string it provides public access for the channel. Token string // Grant read access CanRead bool // Grant write Access CanWrite bool // Time to live value in minutes. // Access is revoked after TTL period // Min-max values can be consecutively: 1 and 525600 // 0 value will grant access indefinitely // -1 causes default value (1440) to be set TTL int }
type Channel ¶
type Channel struct { Name string // contains filtered or unexported fields }
Channel is used for established subscription connections
func (*Channel) ConsumeErrors ¶
type ClientSettings ¶
type PubNubClient ¶
type PubNubClient struct {
// contains filtered or unexported fields
}
func NewPubNubClient ¶
func NewPubNubClient(cs *ClientSettings) *PubNubClient
func (*PubNubClient) Close ¶
func (p *PubNubClient) Close()
func (*PubNubClient) Grant ¶
func (p *PubNubClient) Grant(a *AuthSettings) error
Grant read/write access to the given token for TTL period. If token
func (*PubNubClient) NewChannel ¶
func (p *PubNubClient) NewChannel(name string) (*Channel, error)
NewChannel opens a new subscription channel
func (*PubNubClient) Push ¶
func (p *PubNubClient) Push(channelName string, body interface{}) error
Push sends a message to the channel with channelName. If Access Manager is enabled access must be granted first.
func (*PubNubClient) SetAuthToken ¶
func (p *PubNubClient) SetAuthToken(token string)
type PubNubRequest ¶
type PubNubRequest struct { // request timeout value in second Timeout int // contains filtered or unexported fields }
PubNubRequest is used for each PubNub api call
func NewPubNubRequest ¶
func NewPubNubRequest(channelName string, messages chan<- Message, errors chan<- error) *PubNubRequest
func (*PubNubRequest) Close ¶
func (pr *PubNubRequest) Close()
func (*PubNubRequest) Do ¶
func (pr *PubNubRequest) Do() error
Click to show internal directories.
Click to hide internal directories.