Documentation ¶
Index ¶
- Constants
- Variables
- func NewHttpClient(connectTimeout int, responseReadTimeout int) *http.Client
- type AddChannelToChannelGroupBuilder
- func (b *AddChannelToChannelGroupBuilder) Channels(ch []string) *AddChannelToChannelGroupBuilder
- func (b *AddChannelToChannelGroupBuilder) Execute() (*AddChannelToChannelGroupResponse, StatusResponse, error)
- func (b *AddChannelToChannelGroupBuilder) Group(cg string) *AddChannelToChannelGroupBuilder
- func (b *AddChannelToChannelGroupBuilder) Transport(tr http.RoundTripper) *AddChannelToChannelGroupBuilder
- type AddChannelToChannelGroupResponse
- type AllChannelGroupResponse
- type Config
- type Context
- type DeleteChannelGroupResponse
- type GetStateResponse
- type GrantResponse
- type HereNowChannelData
- type HereNowOccupantsData
- type HereNowResponse
- type HistoryDeleteResponse
- type HistoryResponse
- type HistoryResponseItem
- type Listener
- type ListenerManager
- type OperationType
- type PNAccessManagerKeyData
- type PNMessage
- type PNPAMEntityData
- type PNPresence
- type PNStatus
- type PubNub
- func (pn *PubNub) AddChannelToChannelGroup() *AddChannelToChannelGroupBuilder
- func (pn *PubNub) AddChannelToChannelGroupWithContext(ctx Context) *AddChannelToChannelGroupBuilder
- func (pn *PubNub) AddListener(listener *Listener)
- func (pn *PubNub) DeleteChannelGroup() *deleteChannelGroupBuilder
- func (pn *PubNub) DeleteChannelGroupWithContext(ctx Context) *deleteChannelGroupBuilder
- func (pn *PubNub) DeleteMessages() *historyDeleteBuilder
- func (pn *PubNub) DeleteMessagesWithContext() *historyDeleteBuilder
- func (pn *PubNub) Destroy()
- func (pn *PubNub) GetClient() *http.Client
- func (pn *PubNub) GetListeners() map[*Listener]bool
- func (pn *PubNub) GetState() *getStateBuilder
- func (pn *PubNub) GetStateWithContext(ctx Context) *getStateBuilder
- func (pn *PubNub) GetSubscribeClient() *http.Client
- func (pn *PubNub) GetSubscribedChannels() []string
- func (pn *PubNub) GetSubscribedGroups() []string
- func (pn *PubNub) Grant() *grantBuilder
- func (pn *PubNub) GrantWithContext(ctx Context) *grantBuilder
- func (pn *PubNub) HereNow() *hereNowBuilder
- func (pn *PubNub) HereNowWithContext(ctx Context) *hereNowBuilder
- func (pn *PubNub) History() *historyBuilder
- func (pn *PubNub) HistoryWithContext(ctx Context) *historyBuilder
- func (pn *PubNub) Leave() *leaveBuilder
- func (pn *PubNub) LeaveWithContext(ctx Context) *leaveBuilder
- func (pn *PubNub) ListChannelsInChannelGroup() *allChannelGroupBuilder
- func (pn *PubNub) ListChannelsInChannelGroupWithContext(ctx Context) *allChannelGroupBuilder
- func (pn *PubNub) Publish() *publishBuilder
- func (pn *PubNub) PublishWithContext(ctx Context) *publishBuilder
- func (pn *PubNub) RemoveChannelFromChannelGroup() *RemoveChannelFromChannelGroupBuilder
- func (pn *PubNub) RemoveChannelFromChannelGroupWithContext(ctx Context) *RemoveChannelFromChannelGroupBuilder
- func (pn *PubNub) RemoveListener(listener *Listener)
- func (pn *PubNub) SetClient(c *http.Client)
- func (pn *PubNub) SetState() *setStateBuilder
- func (pn *PubNub) SetStateWithContext(ctx Context) *setStateBuilder
- func (pn *PubNub) SetSubscribeClient(client *http.Client)
- func (pn *PubNub) Subscribe(operation *SubscribeOperation)
- func (pn *PubNub) Time() *timeBuilder
- func (pn *PubNub) TimeWithContext(ctx Context) *timeBuilder
- func (pn *PubNub) Unsubscribe(operation *UnsubscribeOperation)
- func (pn *PubNub) UnsubscribeAll()
- func (pn *PubNub) WhereNow() *whereNowBuilder
- func (pn *PubNub) WhereNowWithContext(ctx Context) *whereNowBuilder
- type PublishResponse
- type ReconnectionManager
- type ReconnectionPolicy
- type RemoveChannelFromChannelGroupBuilder
- func (b *RemoveChannelFromChannelGroupBuilder) Channels(ch []string) *RemoveChannelFromChannelGroupBuilder
- func (b *RemoveChannelFromChannelGroupBuilder) Execute() (*RemoveChannelFromChannelGroupResponse, StatusResponse, error)
- func (b *RemoveChannelFromChannelGroupBuilder) Group(cg string) *RemoveChannelFromChannelGroupBuilder
- type RemoveChannelFromChannelGroupResponse
- type ResponseInfo
- type SetStateResponse
- type StateManager
- type StateOperation
- type StatusCategory
- type StatusResponse
- type SubscribeOperation
- type SubscribeOpts
- type SubscribeResponse
- type SubscriptionItem
- type SubscriptionManager
- type TimeResponse
- type UnsubscribeOperation
- type WhereNowResponse
Constants ¶
View Source
const ( Version = "4.0.0-beta.3" MaxSequence = 65535 )
Default constants
View Source
const ( StrMissingPubKey = "Missing Publish Key" StrMissingSubKey = "Missing Subscribe Key" StrMissingChannel = "Missing Channel" StrMissingChannelGroup = "Missing Channel Group" StrMissingMessage = "Missing Message" StrMissingSecretKey = "Missing Secret Key" StrMissingUuid = "Missing Uuid" )
View Source
const ( RECONNECTION_INTERVAL = 3 RECONNECTION_MINEXPONENTIALBACKOFF = 1 RECONNECTION_MAXEXPONENTIALBACKOFF = 32 )
View Source
const ADD_CHANNEL_CHANNEL_GROUP_PATH = "/v1/channel-registration/sub-key/%s/channel-group/%s"
View Source
const ALL_CHANNEL_GROUP = "/v1/channel-registration/sub-key/%s/channel-group/%s"
View Source
const DELETE_CHANNEL_GROUP = "/v1/channel-registration/sub-key/%s/channel-group/%s/remove"
View Source
const GET_STATE_PATH = "/v2/presence/sub-key/%s/channel/%s/uuid/%s"
View Source
const GRANT_PATH = "/v1/auth/grant/sub-key/%s"
View Source
const HEARTBEAT_PATH = "/v2/presence/sub-key/%s/channel/%s/heartbeat"
View Source
const HISTORY_DELETE_PATH = "/v3/history/sub-key/%s/channel/%s"
View Source
const HISTORY_PATH = "/v2/history/sub-key/%s/channel/%s"
View Source
const LEAVE_PATH = "/v2/presence/sub-key/%s/channel/%s/leave"
View Source
const MAX_COUNT = 100
View Source
const (
PRESENCE_TIMEOUT = 300
)
View Source
const PUBLISH_GET_PATH = "/publish/%s/%s/0/%s/%s/%s"
View Source
const PUBLISH_POST_PATH = "/publish/%s/%s/0/%s/%s"
View Source
const REMOVE_CHANNEL_CHANNEL_GROUP = "/v1/channel-registration/sub-key/%s/channel-group/%s"
View Source
const SET_STATE_PATH = "/v2/presence/sub-key/%s/channel/%s/uuid/%s/data"
View Source
const SUBSCRIBE_PATH = "/v2/subscribe/%s/%s/0"
View Source
const TIME_PATH = "/time/0"
Variables ¶
View Source
var GLOBAL_HERE_NOW_PATH = "/v2/presence/sub_key/%s"
View Source
var HERE_NOW_PATH = "/v2/presence/sub_key/%s/channel/%s"
View Source
var WHERE_NOW_PATH = "/v2/presence/sub-key/%s/uuid/%s"
Functions ¶
Types ¶
type AddChannelToChannelGroupBuilder ¶
type AddChannelToChannelGroupBuilder struct {
// contains filtered or unexported fields
}
func (*AddChannelToChannelGroupBuilder) Channels ¶
func (b *AddChannelToChannelGroupBuilder) Channels( ch []string) *AddChannelToChannelGroupBuilder
func (*AddChannelToChannelGroupBuilder) Execute ¶
func (b *AddChannelToChannelGroupBuilder) Execute() ( *AddChannelToChannelGroupResponse, StatusResponse, error)
func (*AddChannelToChannelGroupBuilder) Group ¶
func (b *AddChannelToChannelGroupBuilder) Group( cg string) *AddChannelToChannelGroupBuilder
func (*AddChannelToChannelGroupBuilder) Transport ¶
func (b *AddChannelToChannelGroupBuilder) Transport( tr http.RoundTripper) *AddChannelToChannelGroupBuilder
type AddChannelToChannelGroupResponse ¶
type AddChannelToChannelGroupResponse struct { }
type AllChannelGroupResponse ¶
type Config ¶
type Config struct { PublishKey string SubscribeKey string SecretKey string AuthKey string Origin string Uuid string CipherKey string Secure bool // net.Dialer.Timeout ConnectTimeout int // http.Client.Timeout for non-subscribe requests NonSubscribeRequestTimeout int // http.Client.Timeout for subscribe requests only SubscribeRequestTimeout int HeartbeatInterval int PresenceTimeout int MaximumReconnectionRetries int FilterExpression string PNReconnectionPolicy ReconnectionPolicy }
func NewDemoConfig ¶
func NewDemoConfig() *Config
func (*Config) SetPresenceTimeout ¶
func (*Config) SetPresenceTimeoutWithCustomInterval ¶
type DeleteChannelGroupResponse ¶
type DeleteChannelGroupResponse struct{}
type GetStateResponse ¶
type GetStateResponse struct {
State map[string]interface{}
}
type GrantResponse ¶
type GrantResponse struct { Level string SubscribeKey string Ttl int Channels map[string]*PNPAMEntityData ChannelGroups map[string]*PNPAMEntityData ReadEnabled bool WriteEnabled bool ManageEnabled bool }
type HereNowChannelData ¶
type HereNowChannelData struct { ChannelName string Occupancy int Occupants []HereNowOccupantsData }
type HereNowOccupantsData ¶
type HereNowResponse ¶
type HereNowResponse struct { TotalChannels int TotalOccupancy int Channels []HereNowChannelData }
type HistoryDeleteResponse ¶
type HistoryDeleteResponse struct { }
type HistoryResponse ¶
type HistoryResponse struct { Messages []HistoryResponseItem StartTimetoken int64 EndTimetoken int64 }
type HistoryResponseItem ¶
type HistoryResponseItem struct { Message interface{} Timetoken int64 }
type Listener ¶
type Listener struct { Status chan *PNStatus Message chan *PNMessage Presence chan *PNPresence }
func NewListener ¶
func NewListener() *Listener
type ListenerManager ¶
type OperationType ¶
type OperationType int
const ( PNSubscribeOperation OperationType = 1 + iota PNUnsubscribeOperation PNPublishOperation PNHistoryOperation PNFetchMessagesOperation PNWhereNowOperation PNHereNowOperation PNHeartBeatOperation PNSetStateOperation PNGetStateOperation PNAddChannelsToChannelGroupOperation PNRemoveChannelFromChannelGroupOperation PNRemoveGroupOperation PNChannelsForGroupOperation PNPushNotificationsEnabledChannelsOperation PNAddPushNotificationsOnChannelsOperation PNRemovePushNotificationsFromChannelsOperation PNRemoveAllPushNotificationsOperation PNTimeOperation PNAccessManagerGrant PNAccessManagerRevoke PNDeleteMessagesOperation )
func (OperationType) String ¶
func (t OperationType) String() string
type PNAccessManagerKeyData ¶
type PNPAMEntityData ¶
type PNPresence ¶
type PubNub ¶
No server connection will be established when you create a new PubNub object. To establish a new connection use Subscribe() function of PubNub type.
func NewPubNubDemo ¶
func NewPubNubDemo() *PubNub
func (*PubNub) AddChannelToChannelGroup ¶
func (pn *PubNub) AddChannelToChannelGroup() *AddChannelToChannelGroupBuilder
func (*PubNub) AddChannelToChannelGroupWithContext ¶
func (pn *PubNub) AddChannelToChannelGroupWithContext( ctx Context) *AddChannelToChannelGroupBuilder
func (*PubNub) AddListener ¶
func (*PubNub) DeleteChannelGroup ¶
func (pn *PubNub) DeleteChannelGroup() *deleteChannelGroupBuilder
func (*PubNub) DeleteChannelGroupWithContext ¶
func (*PubNub) DeleteMessages ¶
func (pn *PubNub) DeleteMessages() *historyDeleteBuilder
func (*PubNub) DeleteMessagesWithContext ¶
func (pn *PubNub) DeleteMessagesWithContext() *historyDeleteBuilder
func (*PubNub) GetListeners ¶
func (*PubNub) GetStateWithContext ¶
func (*PubNub) GetSubscribeClient ¶
Set a client for transactional requests
func (*PubNub) GetSubscribedChannels ¶
func (*PubNub) GetSubscribedGroups ¶
func (*PubNub) GrantWithContext ¶
func (*PubNub) HereNowWithContext ¶
func (*PubNub) HistoryWithContext ¶
func (*PubNub) LeaveWithContext ¶
func (*PubNub) ListChannelsInChannelGroup ¶
func (pn *PubNub) ListChannelsInChannelGroup() *allChannelGroupBuilder
func (*PubNub) ListChannelsInChannelGroupWithContext ¶
func (*PubNub) PublishWithContext ¶
func (*PubNub) RemoveChannelFromChannelGroup ¶
func (pn *PubNub) RemoveChannelFromChannelGroup() *RemoveChannelFromChannelGroupBuilder
func (*PubNub) RemoveChannelFromChannelGroupWithContext ¶
func (pn *PubNub) RemoveChannelFromChannelGroupWithContext( ctx Context) *RemoveChannelFromChannelGroupBuilder
func (*PubNub) RemoveListener ¶
func (*PubNub) SetStateWithContext ¶
func (*PubNub) SetSubscribeClient ¶
func (*PubNub) Subscribe ¶
func (pn *PubNub) Subscribe(operation *SubscribeOperation)
func (*PubNub) TimeWithContext ¶
func (*PubNub) Unsubscribe ¶
func (pn *PubNub) Unsubscribe(operation *UnsubscribeOperation)
func (*PubNub) UnsubscribeAll ¶
func (pn *PubNub) UnsubscribeAll()
func (*PubNub) WhereNowWithContext ¶
type PublishResponse ¶
type PublishResponse struct {
Timestamp int
}
type ReconnectionManager ¶
type ReconnectionManager struct { sync.RWMutex ExponentialMultiplier int FailedCalls int Milliseconds int OnReconnection func() OnMaxReconnectionExhaustion func() DoneTimer chan bool Timer *time.Ticker // contains filtered or unexported fields }
func (*ReconnectionManager) HandleOnMaxReconnectionExhaustion ¶
func (m *ReconnectionManager) HandleOnMaxReconnectionExhaustion(handler func())
func (*ReconnectionManager) HandleReconnection ¶
func (m *ReconnectionManager) HandleReconnection(handler func())
type ReconnectionPolicy ¶
type ReconnectionPolicy int
const ( PNNonePolicy ReconnectionPolicy = 1 + iota PNLinearPolicy PNExponentialPolicy )
TODO: add prefix
type RemoveChannelFromChannelGroupBuilder ¶
type RemoveChannelFromChannelGroupBuilder struct {
// contains filtered or unexported fields
}
func (*RemoveChannelFromChannelGroupBuilder) Channels ¶
func (b *RemoveChannelFromChannelGroupBuilder) Channels( ch []string) *RemoveChannelFromChannelGroupBuilder
func (*RemoveChannelFromChannelGroupBuilder) Execute ¶
func (b *RemoveChannelFromChannelGroupBuilder) Execute() ( *RemoveChannelFromChannelGroupResponse, StatusResponse, error)
func (*RemoveChannelFromChannelGroupBuilder) Group ¶
func (b *RemoveChannelFromChannelGroupBuilder) Group( cg string) *RemoveChannelFromChannelGroupBuilder
type RemoveChannelFromChannelGroupResponse ¶
type RemoveChannelFromChannelGroupResponse struct { }
type ResponseInfo ¶
type SetStateResponse ¶
type SetStateResponse struct {
State []interface{}
}
type StateManager ¶
type StateOperation ¶
type StateOperation struct {
// contains filtered or unexported fields
}
type StatusCategory ¶
type StatusCategory int
const ( PNUnknownCategory StatusCategory = 1 + iota // Request timeout reached PNTimeoutCategory // Subscribe received an initial timetoken PNConnectedCategory // Disconnected due network error PNDisconnectedCategory // Context cancelled PNCancelledCategory PNLoopStopCategory PNAcknowledgmentCategory PNBadRequestCategory PNAccessDeniedCategory PNNoStubMatchedCategory PNReconnectedCategory PNReconnectionAttemptsExhausted )
func (StatusCategory) String ¶
func (c StatusCategory) String() string
type StatusResponse ¶
type SubscribeOperation ¶
type SubscribeOpts ¶
type SubscribeResponse ¶
type SubscribeResponse struct { }
type SubscriptionItem ¶
type SubscriptionItem struct {
// contains filtered or unexported fields
}
type SubscriptionManager ¶
func (*SubscriptionManager) AddListener ¶
func (m *SubscriptionManager) AddListener(listener *Listener)
func (*SubscriptionManager) Disconnect ¶
func (m *SubscriptionManager) Disconnect()
func (*SubscriptionManager) GetListeners ¶
func (m *SubscriptionManager) GetListeners() map[*Listener]bool
func (*SubscriptionManager) RemoveAllListeners ¶
func (m *SubscriptionManager) RemoveAllListeners()
func (*SubscriptionManager) RemoveListener ¶
func (m *SubscriptionManager) RemoveListener(listener *Listener)
type TimeResponse ¶
type TimeResponse struct {
Timetoken int64
}
type UnsubscribeOperation ¶
type WhereNowResponse ¶
type WhereNowResponse struct {
Channels []string
}
Source Files ¶
- add_channel_channel_group_request.go
- clients.go
- config.go
- context.go
- crypto.go
- delete_channel_group_request.go
- endpoints.go
- enums.go
- get_state_request.go
- grant_request.go
- heartbeat_request.go
- here_now_request.go
- history_delete_request.go
- history_request.go
- leave_request.go
- list_all_channel_group_request.go
- listener_manager.go
- publish_request.go
- pubnub.go
- reconnection_manager.go
- remove_channel_channel_group_request.go
- request.go
- request_context.go
- set_state_request.go
- state_manager.go
- subscribe_context_helper_1_7.go
- subscribe_request.go
- subscription_manager.go
- time_request.go
- where_now_request.go
Click to show internal directories.
Click to hide internal directories.