Documentation ¶
Index ¶
- Constants
- func EnumArrayToStringArray(include interface{}) []string
- func NewHTTP1Client(connectTimeout, responseReadTimeout, maxIdleConnsPerHost int) *http.Client
- func NewHTTP2Client(connectTimeout int, responseReadTimeout int) *http.Client
- func SetPushEnvironment(q *url.Values, env PNPushEnvironment)
- func SetPushTopic(q *url.Values, topic string)
- func SetQueryParam(q *url.Values, queryParam map[string]string)
- type AddChannelToChannelGroupResponse
- type AddPushNotificationsOnChannelsResponse
- type AllChannelGroupResponse
- type ChannelPermissions
- type ChannelPermissionsWithToken
- type Config
- type Context
- type DeleteChannelGroupResponse
- type FetchResponse
- type FetchResponseItem
- type GetStateResponse
- type GrantResources
- type GrantResourcesWithPermissions
- type GrantResponse
- type GroupPermissions
- type GroupPermissionsWithToken
- type HeartbeatManager
- type HereNowChannelData
- type HereNowOccupantsData
- type HereNowResponse
- type HistoryDeleteResponse
- type HistoryResponse
- type HistoryResponseItem
- type JobQItem
- type JobQResponse
- type LatencyEntry
- type ListPushProvisionsRequestResponse
- type Listener
- type ListenerManager
- type MessageAction
- type MessageCountsResponse
- type OperationType
- type Operations
- type PNAPNS2Data
- type PNAPNSData
- type PNAPSData
- type PNAccessManagerKeyData
- type PNAddMessageActionsResponse
- type PNCreateSpaceResponse
- type PNCreateUserResponse
- type PNDeleteSpaceResponse
- type PNDeleteUserResponse
- type PNFCMData
- type PNFCMDataFields
- type PNGetMembersResponse
- type PNGetMembershipsResponse
- type PNGetMessageActionsMore
- type PNGetMessageActionsResponse
- type PNGetSpaceResponse
- type PNGetSpacesResponse
- type PNGetUserResponse
- type PNGetUsersResponse
- type PNGrantBitMask
- type PNGrantTokenData
- type PNGrantTokenDecoded
- type PNGrantTokenResponse
- type PNGrantType
- type PNHistoryMessageActionTypeVal
- type PNHistoryMessageActionsTypeMap
- type PNMPNSData
- type PNManageMembersResponse
- type PNManageMembershipsResponse
- type PNMembers
- type PNMembersInclude
- type PNMembersInput
- type PNMembersInputChangeSet
- type PNMembersRemove
- type PNMembershipEvent
- type PNMemberships
- type PNMembershipsInclude
- type PNMembershipsInput
- type PNMembershipsInputChangeSet
- type PNMembershipsRemove
- type PNMessage
- type PNMessageActionsEvent
- type PNMessageActionsEventType
- type PNMessageActionsResponse
- type PNMessageType
- type PNObjectsEvent
- type PNObjectsEventType
- type PNObjectsResponse
- type PNPAMEntityData
- type PNPresence
- type PNPushEnvironment
- type PNPushTarget
- type PNPushType
- type PNRemoveMessageActionsResponse
- type PNResourceType
- type PNSpace
- type PNSpaceEvent
- type PNStatus
- type PNUpdateSpaceResponse
- type PNUpdateUserResponse
- type PNUser
- type PNUserEvent
- type PNUserSpaceInclude
- type PermissionsBody
- type PubNub
- func (pn *PubNub) AddChannelToChannelGroup() *addChannelToChannelGroupBuilder
- func (pn *PubNub) AddChannelToChannelGroupWithContext(ctx Context) *addChannelToChannelGroupBuilder
- func (pn *PubNub) AddListener(listener *Listener)
- func (pn *PubNub) AddMessageAction() *addMessageActionsBuilder
- func (pn *PubNub) AddMessageActionWithContext(ctx Context) *addMessageActionsBuilder
- func (pn *PubNub) AddPushNotificationsOnChannels() *addPushNotificationsOnChannelsBuilder
- func (pn *PubNub) AddPushNotificationsOnChannelsWithContext(ctx Context) *addPushNotificationsOnChannelsBuilder
- func (pn *PubNub) CreatePushPayload() *publishPushHelperBuilder
- func (pn *PubNub) CreatePushPayloadWithContext(ctx Context) *publishPushHelperBuilder
- func (pn *PubNub) CreateSpace() *createSpaceBuilder
- func (pn *PubNub) CreateSpaceWithContext(ctx Context) *createSpaceBuilder
- func (pn *PubNub) CreateUser() *createUserBuilder
- func (pn *PubNub) CreateUserWithContext(ctx Context) *createUserBuilder
- func (pn *PubNub) DeleteChannelGroup() *deleteChannelGroupBuilder
- func (pn *PubNub) DeleteChannelGroupWithContext(ctx Context) *deleteChannelGroupBuilder
- func (pn *PubNub) DeleteMessages() *historyDeleteBuilder
- func (pn *PubNub) DeleteMessagesWithContext(ctx Context) *historyDeleteBuilder
- func (pn *PubNub) DeleteSpace() *deleteSpaceBuilder
- func (pn *PubNub) DeleteSpaceWithContext(ctx Context) *deleteSpaceBuilder
- func (pn *PubNub) DeleteUser() *deleteUserBuilder
- func (pn *PubNub) DeleteUserWithContext(ctx Context) *deleteUserBuilder
- func (pn *PubNub) Destroy()
- func (pn *PubNub) Fetch() *fetchBuilder
- func (pn *PubNub) FetchWithContext(ctx Context) *fetchBuilder
- func (pn *PubNub) Fire() *fireBuilder
- func (pn *PubNub) FireWithContext(ctx Context) *fireBuilder
- func (pn *PubNub) GetClient() *http.Client
- func (pn *PubNub) GetListeners() map[*Listener]bool
- func (pn *PubNub) GetMembers() *getMembersBuilder
- func (pn *PubNub) GetMembersWithContext(ctx Context) *getMembersBuilder
- func (pn *PubNub) GetMemberships() *getMembershipsBuilder
- func (pn *PubNub) GetMembershipsWithContext(ctx Context) *getMembershipsBuilder
- func (pn *PubNub) GetMessageActions() *getMessageActionsBuilder
- func (pn *PubNub) GetMessageActionsWithContext(ctx Context) *getMessageActionsBuilder
- func (pn *PubNub) GetSpace() *getSpaceBuilder
- func (pn *PubNub) GetSpaceWithContext(ctx Context) *getSpaceBuilder
- func (pn *PubNub) GetSpaces() *getSpacesBuilder
- func (pn *PubNub) GetSpacesWithContext(ctx Context) *getSpacesBuilder
- 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) GetToken(resourceId string, resourceType PNResourceType) string
- func (pn *PubNub) GetTokens() GrantResourcesWithPermissions
- func (pn *PubNub) GetTokensByResource(resourceType PNResourceType) GrantResourcesWithPermissions
- func (pn *PubNub) GetUser() *getUserBuilder
- func (pn *PubNub) GetUserWithContext(ctx Context) *getUserBuilder
- func (pn *PubNub) GetUsers() *getUsersBuilder
- func (pn *PubNub) GetUsersWithContext(ctx Context) *getUsersBuilder
- func (pn *PubNub) Grant() *grantBuilder
- func (pn *PubNub) GrantToken() *grantTokenBuilder
- func (pn *PubNub) GrantTokenWithContext(ctx Context) *grantTokenBuilder
- 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) ListPushProvisions() *listPushProvisionsRequestBuilder
- func (pn *PubNub) ListPushProvisionsWithContext(ctx Context) *listPushProvisionsRequestBuilder
- func (pn *PubNub) ManageMembers() *manageMembersBuilder
- func (pn *PubNub) ManageMembersWithContext(ctx Context) *manageMembersBuilder
- func (pn *PubNub) ManageMemberships() *manageMembershipsBuilder
- func (pn *PubNub) ManageMembershipsWithContext(ctx Context) *manageMembershipsBuilder
- func (pn *PubNub) MessageCounts() *messageCountsBuilder
- func (pn *PubNub) MessageCountsWithContext(ctx Context) *messageCountsBuilder
- func (pn *PubNub) Presence() *presenceBuilder
- func (pn *PubNub) PresenceWithContext(ctx Context) *presenceBuilder
- func (pn *PubNub) Publish() *publishBuilder
- func (pn *PubNub) PublishWithContext(ctx Context) *publishBuilder
- func (pn *PubNub) RemoveAllPushNotifications() *removeAllPushChannelsForDeviceBuilder
- func (pn *PubNub) RemoveAllPushNotificationsWithContext(ctx Context) *removeAllPushChannelsForDeviceBuilder
- func (pn *PubNub) RemoveChannelFromChannelGroup() *removeChannelFromChannelGroupBuilder
- func (pn *PubNub) RemoveChannelFromChannelGroupWithContext(ctx Context) *removeChannelFromChannelGroupBuilder
- func (pn *PubNub) RemoveListener(listener *Listener)
- func (pn *PubNub) RemoveMessageAction() *removeMessageActionsBuilder
- func (pn *PubNub) RemoveMessageActionWithContext(ctx Context) *removeMessageActionsBuilder
- func (pn *PubNub) RemovePushNotificationsFromChannels() *removeChannelsFromPushBuilder
- func (pn *PubNub) RemovePushNotificationsFromChannelsWithContext(ctx Context) *removeChannelsFromPushBuilder
- func (pn *PubNub) ResetTokenManager()
- 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) SetToken(token string)
- func (pn *PubNub) SetTokens(tokens []string)
- func (pn *PubNub) Signal() *signalBuilder
- func (pn *PubNub) SignalWithContext(ctx Context) *signalBuilder
- func (pn *PubNub) Subscribe() *subscribeBuilder
- func (pn *PubNub) Time() *timeBuilder
- func (pn *PubNub) TimeWithContext(ctx Context) *timeBuilder
- func (pn *PubNub) Unsubscribe() *unsubscribeBuilder
- func (pn *PubNub) UnsubscribeAll()
- func (pn *PubNub) UpdateSpace() *updateSpaceBuilder
- func (pn *PubNub) UpdateSpaceWithContext(ctx Context) *updateSpaceBuilder
- func (pn *PubNub) UpdateUser() *updateUserBuilder
- func (pn *PubNub) UpdateUserWithContext(ctx Context) *updateUserBuilder
- func (pn *PubNub) WhereNow() *whereNowBuilder
- func (pn *PubNub) WhereNowWithContext(ctx Context) *whereNowBuilder
- type PublishResponse
- type ReconnectionManager
- type ReconnectionPolicy
- type RemoveAllPushChannelsForDeviceResponse
- type RemoveChannelFromChannelGroupResponse
- type RemoveChannelsFromPushResponse
- type RequestWorkers
- type ResourcePermissions
- type ResponseInfo
- type SetStateResponse
- type SignalResponse
- type StateManager
- type StateOperation
- type StatusCategory
- type StatusResponse
- type SubscribeOperation
- type SubscriptionItem
- type SubscriptionManager
- func (m *SubscriptionManager) AddListener(listener *Listener)
- func (m *SubscriptionManager) Destroy()
- func (m *SubscriptionManager) Disconnect()
- func (m *SubscriptionManager) GetListeners() map[*Listener]bool
- func (m *SubscriptionManager) RemoveAllListeners()
- func (m *SubscriptionManager) RemoveListener(listener *Listener)
- type TelemetryManager
- type TimeResponse
- type TokenManager
- func (m *TokenManager) CleanUp()
- func (m *TokenManager) GetAllTokens() GrantResourcesWithPermissions
- func (m *TokenManager) GetToken(resourceID string, resourceType PNResourceType) string
- func (m *TokenManager) GetTokensByResource(resourceType PNResourceType) GrantResourcesWithPermissions
- func (m *TokenManager) SetAuthParan(q *url.Values, resourceID string, resourceType PNResourceType)
- func (m *TokenManager) StoreToken(token string)
- func (m *TokenManager) StoreTokens(token []string)
- type UnsubscribeOperation
- type UpdateSpaceBody
- type UpdateUserBody
- type UserSpacePermissions
- type UserSpacePermissionsWithToken
- type WhereNowResponse
- type Worker
Constants ¶
const ( // PNObjectsUserEvent is the enum when the event of type `user` occurs PNObjectsUserEvent PNObjectsEventType = "user" // PNObjectsSpaceEvent is the enum when the event of type `space` occurs PNObjectsSpaceEvent = "space" // PNObjectsMembershipEvent is the enum when the event of type `membership` occurs PNObjectsMembershipEvent = "membership" // PNObjectsNoneEvent is used for error handling PNObjectsNoneEvent = "none" )
const ( // PNObjectsEventCreate is the enum when the event `create` occurs PNObjectsEventCreate PNObjectsEvent = "create" // PNObjectsEventUpdate is the enum when the event `update` occurs PNObjectsEventUpdate = "update" // PNObjectsEventDelete is the enum when the event `delete` occurs PNObjectsEventDelete = "delete" )
const ( // PNRead Read Perms PNRead PNGrantBitMask = 1 // PNWrite Write Perms PNWrite = 2 // PNManage Manage Perms PNManage = 4 // PNDelete Delete Perms PNDelete = 8 // PNCreate Create Perms PNCreate = 16 )
const ( // Version :the version of the SDK Version = "4.6.4" // MaxSequence for publish messages MaxSequence = 65535 )
Default constants
const ( // StrMissingPubKey shows Missing Publish Key message StrMissingPubKey = "Missing Publish Key" // StrMissingSubKey shows Missing Subscribe Key message StrMissingSubKey = "Missing Subscribe Key" // StrMissingChannel shows Channel message StrMissingChannel = "Missing Channel" // StrMissingChannelGroup shows Channel Group message StrMissingChannelGroup = "Missing Channel Group" // StrMissingMessage shows Missing Message message StrMissingMessage = "Missing Message" // StrMissingSecretKey shows Missing Secret Key message StrMissingSecretKey = "Missing Secret Key" // StrMissingUUID shows Missing UUID message StrMissingUUID = "Missing UUID" // StrMissingDeviceID shows Missing Device ID message StrMissingDeviceID = "Missing Device ID" // StrMissingPushType shows Missing Push Type message StrMissingPushType = "Missing Push Type" // StrMissingPushTopic shows Missing Push Topic message StrMissingPushTopic = "Missing Push Topic" // StrChannelsTimetoken shows Missing Channels Timetoken message StrChannelsTimetoken = "Missing Channels Timetoken" // StrChannelsTimetokenLength shows Length of Channels Timetoken message StrChannelsTimetokenLength = "Length of Channels Timetoken and Channels do not match" // StrInvalidTTL shows Invalid TTL message StrInvalidTTL = "Invalid TTL" // StrMissingPushTitle shows `Push title missing` message StrMissingPushTitle = "Push title missing" )
Variables ¶
This section is empty.
Functions ¶
func EnumArrayToStringArray ¶
func EnumArrayToStringArray(include interface{}) []string
EnumArrayToStringArray converts a string enum to an array
func NewHTTP1Client ¶
NewHTTP1Client creates a new HTTP 1 client with a new transport initialized with connect and read timeout
func NewHTTP2Client ¶
NewHTTP2Client creates a new HTTP 2 client with a new transport initialized with connect and read timeout
func SetPushEnvironment ¶
func SetPushEnvironment(q *url.Values, env PNPushEnvironment)
SetPushEnvironment appends the push environment to the query string
func SetPushTopic ¶
SetPushTopic appends the topic to the query string
Types ¶
type AddChannelToChannelGroupResponse ¶
type AddChannelToChannelGroupResponse struct { }
AddChannelToChannelGroupResponse is the struct returned when the Execute function of AddChannelToChannelGroup is called.
type AddPushNotificationsOnChannelsResponse ¶
type AddPushNotificationsOnChannelsResponse struct{}
AddPushNotificationsOnChannelsResponse is response structure for AddPushNotificationsOnChannelsBuilder
type AllChannelGroupResponse ¶
AllChannelGroupResponse is the struct returned when the Execute function of List All Channel Groups is called.
type ChannelPermissions ¶
ChannelPermissions contains all the acceptable perms for channels
type ChannelPermissionsWithToken ¶
type ChannelPermissionsWithToken struct { Permissions ChannelPermissions BitMaskPerms int64 Token string Timestamp int64 TTL int }
ChannelPermissionsWithToken is used for channels resource type permissions
type Config ¶
type Config struct { sync.RWMutex PublishKey string // PublishKey you can get it from admin panel (only required if publishing). SubscribeKey string // SubscribeKey you can get it from admin panel. SecretKey string // SecretKey (only required for modifying/revealing access permissions). AuthKey string // AuthKey If Access Manager is utilized, client will use this AuthKey in all restricted requests. Origin string // Custom Origin if needed UUID string // UUID to be used as a device identifier, a default uuid is generated if not passed. CipherKey string // If CipherKey is passed, all communications to/from PubNub will be encrypted. Secure bool // True to use TLS ConnectTimeout int // net.Dialer.Timeout NonSubscribeRequestTimeout int // http.Client.Timeout for non-subscribe requests SubscribeRequestTimeout int // http.Client.Timeout for subscribe requests only HeartbeatInterval int // The frequency of the pings to the server to state that the client is active PresenceTimeout int // The time after which the server will send a timeout for the client MaximumReconnectionRetries int // The config sets how many times to retry to reconnect before giving up. MaximumLatencyDataAge int // Max time to store the latency data for telemetry FilterExpression string // Feature to subscribe with a custom filter expression. PNReconnectionPolicy ReconnectionPolicy // Reconnection policy selection Log *log.Logger // Logger instance SuppressLeaveEvents bool // When true the SDK doesn't send out the leave requests. DisablePNOtherProcessing bool // PNOther processing looks for pn_other in the JSON on the recevied message UseHTTP2 bool // HTTP2 Flag MessageQueueOverflowCount int // When the limit is exceeded by the number of messages received in a single subscribe request, a status event PNRequestMessageCountExceededCategory is fired. MaxIdleConnsPerHost int // Used to set the value of HTTP Transport's MaxIdleConnsPerHost. MaxWorkers int // Number of max workers for Publish and Grant requests UsePAMV3 bool // Use PAM version 2, Objects requets would still use PAM v3 StoreTokensOnGrant bool // Will store grant v3 tokens in token manager for further use. }
Config instance is storage for user-provided information which describe further PubNub client behaviour. Configuration instance contain additional set of properties which allow to perform precise PubNub client configuration.
func NewDemoConfig ¶
func NewDemoConfig() *Config
NewDemoConfig initiates the config with demo keys, for tests only.
func (*Config) SetPresenceTimeout ¶
SetPresenceTimeout sets the presence timeout and automatically calulates the preferred timeout value. timeout: How long the server will consider the client alive for presence.
func (*Config) SetPresenceTimeoutWithCustomInterval ¶
SetPresenceTimeoutWithCustomInterval sets the presence timeout and interval. timeout: How long the server will consider the client alive for presence. interval: How often the client will announce itself to server.
type DeleteChannelGroupResponse ¶
type DeleteChannelGroupResponse struct{}
DeleteChannelGroupResponse is response structure for Delete Channel Group function
type FetchResponse ¶
type FetchResponse struct {
Messages map[string][]FetchResponseItem
}
FetchResponse is the response to Fetch request. It contains a map of type FetchResponseItem
type FetchResponseItem ¶
type FetchResponseItem struct { Message interface{} `json:"message"` Meta interface{} `json:"meta"` MessageActions map[string]PNHistoryMessageActionsTypeMap `json:"actions"` Timetoken string `json:"timetoken"` }
FetchResponseItem contains the message and the associated timetoken.
type GetStateResponse ¶
GetStateResponse is the struct returned when the Execute function of GetState is called.
type GrantResources ¶
type GrantResources struct { Channels map[string]int64 `json:"channels" cbor:"chan"` Groups map[string]int64 `json:"groups" cbor:"grp"` Users map[string]int64 `json:"users" cbor:"usr"` Spaces map[string]int64 `json:"spaces" cbor:"spc"` }
GrantResources is the struct used to decode the server response
type GrantResourcesWithPermissions ¶
type GrantResourcesWithPermissions struct { Channels map[string]ChannelPermissionsWithToken Groups map[string]GroupPermissionsWithToken Users map[string]UserSpacePermissionsWithToken Spaces map[string]UserSpacePermissionsWithToken ChannelsPattern map[string]ChannelPermissionsWithToken GroupsPattern map[string]GroupPermissionsWithToken UsersPattern map[string]UserSpacePermissionsWithToken SpacesPattern map[string]UserSpacePermissionsWithToken }
GrantResourcesWithPermissions is used as a common struct to store all resource type permissions
func ParseGrantResources ¶
func ParseGrantResources(res GrantResources, token string, timetoken int64, ttl int) *GrantResourcesWithPermissions
ParseGrantResources parses the token for permissions and adds them along the other values to the GrantResourcesWithPermissions struct
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 DeleteEnabled bool }
GrantResponse is the struct returned when the Execute function of Grant is called.
type GroupPermissions ¶
GroupPermissions contains all the acceptable perms for groups
type GroupPermissionsWithToken ¶
type GroupPermissionsWithToken struct { Permissions GroupPermissions BitMaskPerms int64 Token string Timestamp int64 TTL int }
GroupPermissionsWithToken is used for groups resource type permissions
type HeartbeatManager ¶
HeartbeatManager is a struct that assists in running of the heartbeat.
func (*HeartbeatManager) Destroy ¶
func (m *HeartbeatManager) Destroy()
Destroy stops the running heartbeat.
type HereNowChannelData ¶
type HereNowChannelData struct { ChannelName string Occupancy int Occupants []HereNowOccupantsData }
HereNowChannelData is the struct containing the occupancy details of the channels.
type HereNowOccupantsData ¶
HereNowOccupantsData is the struct containing the state and UUID of the occupants in the channel.
type HereNowResponse ¶
type HereNowResponse struct { TotalChannels int TotalOccupancy int Channels []HereNowChannelData }
HereNowResponse is the struct returned when the Execute function of HereNow is called.
type HistoryDeleteResponse ¶
type HistoryDeleteResponse struct { }
HistoryDeleteResponse is the struct returned when Delete Messages is called.
type HistoryResponse ¶
type HistoryResponse struct { Messages []HistoryResponseItem StartTimetoken int64 EndTimetoken int64 }
HistoryResponse is used to store the response from the History request.
type HistoryResponseItem ¶
type HistoryResponseItem struct { Message interface{} Meta interface{} Timetoken int64 }
HistoryResponseItem is used to store the Message and the associated timetoken from the History request.
type JobQItem ¶
type JobQItem struct { Req *http.Request Client *http.Client JobResponse chan *JobQResponse }
type JobQResponse ¶
type LatencyEntry ¶
LatencyEntry is the struct to store the timestamp and latency values.
type ListPushProvisionsRequestResponse ¶
type ListPushProvisionsRequestResponse struct {
Channels []string
}
ListPushProvisionsRequestResponse is the struct returned when the Execute function of ListPushProvisions is called.
type Listener ¶
type Listener struct { Status chan *PNStatus Message chan *PNMessage Presence chan *PNPresence Signal chan *PNMessage UserEvent chan *PNUserEvent SpaceEvent chan *PNSpaceEvent MembershipEvent chan *PNMembershipEvent MessageActionsEvent chan *PNMessageActionsEvent }
func NewListener ¶
func NewListener() *Listener
type ListenerManager ¶
type MessageAction ¶
MessageAction struct is used to create a Message Action
type MessageCountsResponse ¶
MessageCountsResponse is the response to MessageCounts request. It contains a map of type MessageCountsResponseItem
type OperationType ¶
type OperationType int
OperationType is used as an enum to catgorize the various operations in the APIs lifecycle
const ( // PNSubscribeOperation is the enum used for the Subcribe operation. PNSubscribeOperation OperationType = 1 + iota // PNUnsubscribeOperation is the enum used for the Unsubcribe operation. PNUnsubscribeOperation // PNPublishOperation is the enum used for the Publish operation. PNPublishOperation // PNFireOperation is the enum used for the Fire operation. PNFireOperation // PNHistoryOperation is the enum used for the History operation. PNHistoryOperation // PNFetchMessagesOperation is the enum used for the Fetch operation. PNFetchMessagesOperation // PNWhereNowOperation is the enum used for the Where Now operation. PNWhereNowOperation // PNHereNowOperation is the enum used for the Here Now operation. PNHereNowOperation // PNHeartBeatOperation is the enum used for the Heartbeat operation. PNHeartBeatOperation // PNSetStateOperation is the enum used for the Set State operation. PNSetStateOperation // PNGetStateOperation is the enum used for the Get State operation. PNGetStateOperation // PNAddChannelsToChannelGroupOperation is the enum used for the Add Channels to Channel Group operation. PNAddChannelsToChannelGroupOperation // PNRemoveChannelFromChannelGroupOperation is the enum used for the Remove Channels from Channel Group operation. PNRemoveChannelFromChannelGroupOperation // PNRemoveGroupOperation is the enum used for the Remove Channel Group operation. PNRemoveGroupOperation // PNChannelsForGroupOperation is the enum used for the List Channels of Channel Group operation. PNChannelsForGroupOperation // PNPushNotificationsEnabledChannelsOperation is the enum used for the List Channels with Push Notifications enabled operation. PNPushNotificationsEnabledChannelsOperation // PNAddPushNotificationsOnChannelsOperation is the enum used for the Add Channels to Push Notifications operation. PNAddPushNotificationsOnChannelsOperation // PNRemovePushNotificationsFromChannelsOperation is the enum used for the Remove Channels from Push Notifications operation. PNRemovePushNotificationsFromChannelsOperation // PNRemoveAllPushNotificationsOperation is the enum used for the Remove All Channels from Push Notifications operation. PNRemoveAllPushNotificationsOperation // PNTimeOperation is the enum used for the Time operation. PNTimeOperation // PNAccessManagerGrant is the enum used for the Access Manager Grant operation. PNAccessManagerGrant // PNAccessManagerRevoke is the enum used for the Access Manager Revoke operation. PNAccessManagerRevoke // PNDeleteMessagesOperation is the enum used for the Delete Messages from History operation. PNDeleteMessagesOperation // PNMessageCountsOperation is the enum used for History with messages operation. PNMessageCountsOperation // PNSignalOperation is the enum used for Signal opertaion. PNSignalOperation // PNCreateUserOperation is the enum used to create users in the Object API. // ENUM ORDER needs to be maintained for Objects AIP PNCreateUserOperation // PNGetUsersOperation is the enum used to get users in the Object API. PNGetUsersOperation // PNGetUserOperation is the enum used to get user in the Object API. PNGetUserOperation // PNUpdateUserOperation is the enum used to update users in the Object API. PNUpdateUserOperation // PNDeleteUserOperation is the enum used to delete users in the Object API. PNDeleteUserOperation // PNGetSpaceOperation is the enum used to get space in the Object API. PNGetSpaceOperation // PNGetSpacesOperation is the enum used to get spaces in the Object API. PNGetSpacesOperation // PNCreateSpaceOperation is the enum used to create space in the Object API. PNCreateSpaceOperation // PNDeleteSpaceOperation is the enum used to delete space in the Object API. PNDeleteSpaceOperation // PNUpdateSpaceOperation is the enum used to update space in the Object API. PNUpdateSpaceOperation // PNGetMembershipsOperation is the enum used to get memberships in the Object API. PNGetMembershipsOperation // PNGetMembersOperation is the enum used to get members in the Object API. PNGetMembersOperation // PNManageMembershipsOperation is the enum used to manage memberships in the Object API. PNManageMembershipsOperation // PNManageMembersOperation is the enum used to manage members in the Object API. // ENUM ORDER needs to be maintained for Objects API. PNManageMembersOperation // PNAccessManagerGrantToken is the enum used for Grant v3 requests. PNAccessManagerGrantToken // PNGetMessageActionsOperation is the enum used for Message Actions Get requests. PNGetMessageActionsOperation // PNHistoryWithActionsOperation is the enum used for History with Actions requests. PNHistoryWithActionsOperation // PNAddMessageActionsOperation is the enum used for Message Actions Add requests. PNAddMessageActionsOperation // PNRemoveMessageActionsOperation is the enum used for Message Actions Remove requests. PNRemoveMessageActionsOperation )
func (OperationType) String ¶
func (t OperationType) String() string
type Operations ¶
type Operations struct {
// contains filtered or unexported fields
}
Operations is the struct to store the latency values of different operations.
type PNAPNS2Data ¶
type PNAPNS2Data struct { CollapseID string `json:"collapseId"` Expiration string `json:"expiration"` Targets []PNPushTarget `json:"targets"` Version string `json:"version"` }
PNAPNS2Data is the struct used for the APNS2 paylod
type PNAPNSData ¶
PNAPNSData is the struct used for the APNS paylod
type PNAPSData ¶
type PNAPSData struct { Alert interface{} `json:"alert"` Badge int `json:"badge"` Sound string `json:"sound"` Title string `json:"title"` Subtitle string `json:"subtitle"` Body string `json:"body"` Custom map[string]interface{} }
PNAPSData is the helper struct used for the APNS paylod
type PNAccessManagerKeyData ¶
type PNAccessManagerKeyData struct { ReadEnabled bool WriteEnabled bool ManageEnabled bool DeleteEnabled bool TTL int }
PNAccessManagerKeyData is the struct containing the access details of the channel groups.
type PNAddMessageActionsResponse ¶
type PNAddMessageActionsResponse struct { Data PNMessageActionsResponse `json:"data"` // contains filtered or unexported fields }
PNAddMessageActionsResponse is the Add Message Actions API Response
type PNCreateSpaceResponse ¶
type PNCreateSpaceResponse struct { Data PNSpace `json:"data"` // contains filtered or unexported fields }
PNCreateSpaceResponse is the Objects API Response for create space
type PNCreateUserResponse ¶
type PNCreateUserResponse struct { Data PNUser `json:"data"` // contains filtered or unexported fields }
PNCreateUserResponse is the Objects API Response for create user
type PNDeleteSpaceResponse ¶
type PNDeleteSpaceResponse struct { Data interface{} `json:"data"` // contains filtered or unexported fields }
PNDeleteSpaceResponse is the Objects API Response for delete space
type PNDeleteUserResponse ¶
type PNDeleteUserResponse struct { Data interface{} `json:"data"` // contains filtered or unexported fields }
PNDeleteUserResponse is the Objects API Response for delete user
type PNFCMData ¶
type PNFCMData struct { Data PNFCMDataFields `json:"data"` Custom map[string]interface{} }
PNFCMData is the struct used for the FCM paylod
type PNFCMDataFields ¶
type PNFCMDataFields struct { Summary interface{} `json:"summary"` Custom map[string]interface{} }
PNFCMDataFields is the helper struct used for the FCM paylod
type PNGetMembersResponse ¶
type PNGetMembersResponse struct { Data []PNMembers `json:"data"` TotalCount int `json:"totalCount"` Next string `json:"next"` Prev string `json:"prev"` // contains filtered or unexported fields }
PNGetMembersResponse is the Objects API Response for Get Members
type PNGetMembershipsResponse ¶
type PNGetMembershipsResponse struct { Data []PNMemberships `json:"data"` TotalCount int `json:"totalCount"` Next string `json:"next"` Prev string `json:"prev"` // contains filtered or unexported fields }
PNGetMembershipsResponse is the Objects API Response for Get Memberships
type PNGetMessageActionsMore ¶
type PNGetMessageActionsMore struct { URL string `json:"url"` Start string `json:"start"` End string `json:"end"` Limit int `json:"limit"` }
PNGetMessageActionsMore is the struct used when the PNGetMessageActionsResponse has more link
type PNGetMessageActionsResponse ¶
type PNGetMessageActionsResponse struct { Data []PNMessageActionsResponse `json:"data"` More PNGetMessageActionsMore `json:"more"` // contains filtered or unexported fields }
PNGetMessageActionsResponse is the GetMessageActions API Response
type PNGetSpaceResponse ¶
type PNGetSpaceResponse struct { Data PNSpace `json:"data"` // contains filtered or unexported fields }
PNGetSpaceResponse is the Objects API Response for Get Space
type PNGetSpacesResponse ¶
type PNGetSpacesResponse struct { Data []PNSpace `json:"data"` TotalCount int `json:"totalCount"` Next string `json:"next"` Prev string `json:"prev"` // contains filtered or unexported fields }
PNGetSpacesResponse is the Objects API Response for Get Spaces
type PNGetUserResponse ¶
type PNGetUserResponse struct { Data PNUser `json:"data"` // contains filtered or unexported fields }
PNGetUserResponse is the Objects API Response for Get User
type PNGetUsersResponse ¶
type PNGetUsersResponse struct { Data []PNUser `json:"data"` TotalCount int `json:"totalCount"` Next string `json:"next"` Prev string `json:"prev"` // contains filtered or unexported fields }
PNGetUsersResponse is the Objects API Response for Get Users
type PNGrantTokenData ¶
PNGrantTokenData is the struct used to decode the server response
type PNGrantTokenDecoded ¶
type PNGrantTokenDecoded struct { Resources GrantResources `cbor:"res"` Patterns GrantResources `cbor:"pat"` Meta map[string]interface{} `cbor:"meta"` Signature []byte `cbor:"sig"` Version int `cbor:"v"` Timestamp int64 `cbor:"t"` TTL int `cbor:"ttl"` }
PNGrantTokenDecoded is the struct used to decode the server response
func GetPermissions ¶
func GetPermissions(token string) (PNGrantTokenDecoded, error)
GetPermissions decodes the CBORToken
type PNGrantTokenResponse ¶
type PNGrantTokenResponse struct { Data PNGrantTokenData `json:"data"` // contains filtered or unexported fields }
PNGrantTokenResponse is the struct returned when the Execute function of Grant Token is called.
type PNGrantType ¶
type PNGrantType int
PNGrantType grant types
const ( // PNReadEnabled Read Enabled. Applies to Subscribe, History, Presence, Objects PNReadEnabled PNGrantType = 1 + iota // PNWriteEnabled Write Enabled. Applies to Publish, Objects PNWriteEnabled // PNManageEnabled Manage Enabled. Applies to Channel-Groups, Objects PNManageEnabled // PNDeleteEnabled Delete Enabled. Applies to History, Objects PNDeleteEnabled // PNCreateEnabled Create Enabled. Applies to Objects PNCreateEnabled )
type PNHistoryMessageActionTypeVal ¶
type PNHistoryMessageActionTypeVal struct { UUID string `json:"uuid"` ActionTimetoken string `json:"actionTimetoken"` }
PNHistoryMessageActionTypeVal is the struct used in the Fetch request that includes Message Actions
type PNHistoryMessageActionsTypeMap ¶
type PNHistoryMessageActionsTypeMap struct {
ActionsTypeValues map[string][]PNHistoryMessageActionTypeVal `json:"-"`
}
PNHistoryMessageActionsTypeMap is the struct used in the Fetch request that includes Message Actions
type PNMPNSData ¶
type PNMPNSData struct { Title string `json:"title"` Type string `json:"type"` Count int `json:"count"` BackTitle string `json:"back_title"` BackContent string `json:"back_content"` Custom map[string]interface{} }
PNMPNSData is the struct used for the MPNS paylod
type PNManageMembersResponse ¶
type PNManageMembersResponse struct { Data []PNMembers `json:"data"` TotalCount int `json:"totalCount"` Next string `json:"next"` Prev string `json:"prev"` // contains filtered or unexported fields }
PNManageMembersResponse is the Objects API Response for ManageMembers
type PNManageMembershipsResponse ¶
type PNManageMembershipsResponse struct { Data []PNMemberships `json:"data"` TotalCount int `json:"totalCount"` Next string `json:"next"` Prev string `json:"prev"` // contains filtered or unexported fields }
PNManageMembershipsResponse is the Objects API Response for ManageMemberships
type PNMembers ¶
type PNMembers struct { ID string `json:"id"` User PNUser `json:"user"` Created string `json:"created"` Updated string `json:"updated"` ETag string `json:"eTag"` Custom map[string]interface{} `json:"custom"` }
PNMembers is the Objects API Members struct
type PNMembersInclude ¶
type PNMembersInclude int
PNMembersInclude is used as an enum to catgorize the available Members include types
const ( // PNMembersCustom is the enum equivalent to the value `custom` available Members include types PNMembersCustom PNMembersInclude = 1 + iota // PNMembersUser is the enum equivalent to the value `user` available Members include types PNMembersUser // PNMembersUserCustom is the enum equivalent to the value `user.custom` available Members include types PNMembersUserCustom )
func (PNMembersInclude) String ¶
func (s PNMembersInclude) String() string
type PNMembersInput ¶
PNMembersInput is the Objects API Members input struct used to add members
type PNMembersInputChangeSet ¶
type PNMembersInputChangeSet struct { Add []PNMembersInput `json:"add"` Update []PNMembersInput `json:"update"` Remove []PNMembersRemove `json:"remove"` }
PNMembersInputChangeSet is the Objects API input to add, remove or update members
type PNMembersRemove ¶
type PNMembersRemove struct {
ID string `json:"id"`
}
PNMembersRemove is the Objects API Members struct used to remove members
type PNMembershipEvent ¶
type PNMembershipEvent struct { Event PNObjectsEvent UserID string SpaceID string Description string Timestamp string Custom map[string]interface{} SubscribedChannel string ActualChannel string Channel string Subscription string }
PNMembershipEvent is the Response for a Membership Event
type PNMemberships ¶
type PNMemberships struct { ID string `json:"id"` Space PNSpace `json:"space"` Created string `json:"created"` Updated string `json:"updated"` ETag string `json:"eTag"` Custom map[string]interface{} `json:"custom"` }
PNMemberships is the Objects API Memberships struct
type PNMembershipsInclude ¶
type PNMembershipsInclude int
PNMembershipsInclude is used as an enum to catgorize the available Memberships include types
const ( // PNMembershipsCustom is the enum equivalent to the value `custom` available Memberships include types PNMembershipsCustom PNMembershipsInclude = 1 + iota // PNMembershipsSpace is the enum equivalent to the value `space` available Memberships include types PNMembershipsSpace // PNMembershipsSpaceCustom is the enum equivalent to the value `space.custom` available Memberships include types PNMembershipsSpaceCustom )
func (PNMembershipsInclude) String ¶
func (s PNMembershipsInclude) String() string
type PNMembershipsInput ¶
type PNMembershipsInput struct { ID string `json:"id"` Custom map[string]interface{} `json:"custom"` }
PNMembershipsInput is the Objects API Memberships input struct used to add members
type PNMembershipsInputChangeSet ¶
type PNMembershipsInputChangeSet struct { Add []PNMembershipsInput `json:"add"` Update []PNMembershipsInput `json:"update"` Remove []PNMembershipsRemove `json:"remove"` }
PNMembershipsInputChangeSet is the Objects API input to add, remove or update membership
type PNMembershipsRemove ¶
type PNMembershipsRemove struct {
ID string `json:"id"`
}
PNMembershipsRemove is the Objects API Memberships struct used to remove members
type PNMessage ¶
type PNMessage struct { Message interface{} UserMetadata interface{} SubscribedChannel string ActualChannel string Channel string Subscription string Publisher string Timetoken int64 }
PNMessage is the Message Response for Subscribe
type PNMessageActionsEvent ¶
type PNMessageActionsEvent struct { Event PNMessageActionsEventType Data PNMessageActionsResponse SubscribedChannel string ActualChannel string Channel string Subscription string }
PNMessageActionsEvent is the Response for a Message Actions Event
type PNMessageActionsEventType ¶
type PNMessageActionsEventType string
PNMessageActionsEventType is used as an enum to catgorize the available Message Actions Event types
const ( // PNMessageActionsAdded is the enum when the event of type `added` occurs PNMessageActionsAdded PNMessageActionsEventType = "added" // PNMessageActionsRemoved is the enum when the event of type `removed` occurs PNMessageActionsRemoved = "removed" )
type PNMessageActionsResponse ¶
type PNMessageActionsResponse struct { ActionType string `json:"type"` ActionValue string `json:"value"` ActionTimetoken string `json:"actionTimetoken"` MessageTimetoken string `json:"messageTimetoken"` UUID string `json:"uuid"` }
PNMessageActionsResponse Message Actions response.
type PNMessageType ¶
type PNMessageType int
PNMessageType is used as an enum to catgorize the Subscribe response.
const ( // PNMessageTypeSignal is to identify Signal the Subscribe response PNMessageTypeSignal PNMessageType = 1 + iota // PNMessageTypeObjects is to identify Objects the Subscribe response PNMessageTypeObjects // PNMessageTypeMessageActions is to identify Actions the Subscribe response PNMessageTypeMessageActions )
type PNObjectsEvent ¶
type PNObjectsEvent string
PNObjectsEvent is used as an enum to catgorize the available Object Events
type PNObjectsEventType ¶
type PNObjectsEventType string
PNObjectsEventType is used as an enum to catgorize the available Object Event types
type PNObjectsResponse ¶
type PNObjectsResponse struct { Event PNObjectsEvent `json:"event"` // enum value EventType PNObjectsEventType `json:"type"` // enum value Name string `json:"name"` UserID string `json:"userId"` // the user id if user related SpaceID string `json:"spaceId"` // the space id if space related Description string `json:"description"` // the description of what happened Timestamp string `json:"timestamp"` // the timetoken of the event ExternalID string `json:"externalId"` ProfileURL string `json:"profileUrl"` Email string `json:"email"` Created string `json:"created"` Updated string `json:"updated"` ETag string `json:"eTag"` Custom map[string]interface{} `json:"custom"` Data map[string]interface{} `json:"data"` }
PNObjectsResponse is the Objects API collective Response struct of all methods.
type PNPAMEntityData ¶
type PNPAMEntityData struct { Name string AuthKeys map[string]*PNAccessManagerKeyData ReadEnabled bool WriteEnabled bool ManageEnabled bool DeleteEnabled bool TTL int }
PNPAMEntityData is the struct containing the access details of the channels.
type PNPresence ¶
type PNPresence struct { Event string UUID string SubscribedChannel string ActualChannel string Channel string Subscription string Occupancy int Timetoken int64 Timestamp int64 UserMetadata map[string]interface{} State interface{} Join []string Leave []string Timeout []string HereNowRefresh bool }
PNPresence is the Message Response for Presence
type PNPushEnvironment ¶
type PNPushEnvironment string
PNPushEnvironment is used as an enum to catgorize the available Message Actions Event types
const ( //PNPushEnvironmentDevelopment for development PNPushEnvironmentDevelopment PNPushEnvironment = "development" //PNPushEnvironmentProduction for production PNPushEnvironmentProduction = "production" )
type PNPushTarget ¶
type PNPushTarget struct { Topic string `json:"topic"` ExcludeDevices []string `json:"exclude_devices"` Environment PNPushEnvironment `json:"environment"` }
PNPushTarget is the helper struct used for the APNS2 paylod
type PNPushType ¶
type PNPushType int
PNPushType is used as an enum to catgorize the available Push Types
const ( // PNPushTypeNone is used as an enum to for selecting `none` as the PNPushType PNPushTypeNone PNPushType = 1 + iota // PNPushTypeGCM is used as an enum to for selecting `GCM` as the PNPushType PNPushTypeGCM // PNPushTypeAPNS is used as an enum to for selecting `APNS` as the PNPushType PNPushTypeAPNS // PNPushTypeMPNS is used as an enum to for selecting `MPNS` as the PNPushType PNPushTypeMPNS // PNPushTypeAPNS2 is used as an enum to for selecting `APNS2` as the PNPushType PNPushTypeAPNS2 )
func (PNPushType) String ¶
func (p PNPushType) String() string
type PNRemoveMessageActionsResponse ¶
type PNRemoveMessageActionsResponse struct { Data interface{} `json:"data"` // contains filtered or unexported fields }
PNRemoveMessageActionsResponse is the Objects API Response for create space
type PNResourceType ¶
type PNResourceType int
PNResourceType grant types
const ( // PNChannels for channels PNChannels PNResourceType = 1 + iota // PNGroups for groups PNGroups // PNUsers for users PNUsers // PNSpaces for spaces PNSpaces )
type PNSpace ¶
type PNSpace struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Created string `json:"created"` Updated string `json:"updated"` ETag string `json:"eTag"` Custom map[string]interface{} `json:"custom"` }
PNSpace is the Objects API space struct
type PNSpaceEvent ¶
type PNSpaceEvent struct { Event PNObjectsEvent SpaceID string Description string Timestamp string Name string Created string Updated string ETag string Custom map[string]interface{} SubscribedChannel string ActualChannel string Channel string Subscription string }
PNSpaceEvent is the Response for a Space Event
type PNStatus ¶
type PNStatus struct { Category StatusCategory Operation OperationType ErrorData error Error bool TLSEnabled bool StatusCode int UUID string AuthKey string Origin string ClientRequest interface{} // Should be same for non-google environment AffectedChannels []string AffectedChannelGroups []string }
PNStatus is the status struct
type PNUpdateSpaceResponse ¶
type PNUpdateSpaceResponse struct { Data PNSpace `json:"data"` // contains filtered or unexported fields }
PNUpdateSpaceResponse is the Objects API Response for Update Space
type PNUpdateUserResponse ¶
type PNUpdateUserResponse struct { Data PNUser `json:"data"` // contains filtered or unexported fields }
PNUpdateUserResponse is the Objects API Response for Update user
type PNUser ¶
type PNUser struct { ID string `json:"id"` Name string `json:"name"` ExternalID string `json:"externalId"` ProfileURL string `json:"profileUrl"` Email string `json:"email"` Created string `json:"created"` Updated string `json:"updated"` ETag string `json:"eTag"` Custom map[string]interface{} `json:"custom"` }
PNUser is the Objects API user struct
type PNUserEvent ¶
type PNUserEvent struct { Event PNObjectsEvent UserID string Description string Timestamp string Name string ExternalID string ProfileURL string Email string Created string Updated string ETag string Custom map[string]interface{} SubscribedChannel string ActualChannel string Channel string Subscription string }
PNUserEvent is the Response for an User Event
type PNUserSpaceInclude ¶
type PNUserSpaceInclude int
PNUserSpaceInclude is used as an enum to catgorize the available User and Space include types
const ( // PNUserSpaceCustom is the enum equivalent to the value `custom` available User and Space include types PNUserSpaceCustom PNUserSpaceInclude = 1 + iota )
func (PNUserSpaceInclude) String ¶
func (s PNUserSpaceInclude) String() string
type PermissionsBody ¶
type PermissionsBody struct { Resources GrantResources `json:"resources"` Patterns GrantResources `json:"patterns"` Meta map[string]interface{} `json:"meta"` }
PermissionsBody is the struct used to decode the server response
type PubNub ¶
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 (*PubNub) AddListener ¶
func (*PubNub) AddMessageAction ¶
func (pn *PubNub) AddMessageAction() *addMessageActionsBuilder
func (*PubNub) AddMessageActionWithContext ¶
func (*PubNub) AddPushNotificationsOnChannels ¶
func (pn *PubNub) AddPushNotificationsOnChannels() *addPushNotificationsOnChannelsBuilder
func (*PubNub) AddPushNotificationsOnChannelsWithContext ¶
func (*PubNub) CreatePushPayload ¶
func (pn *PubNub) CreatePushPayload() *publishPushHelperBuilder
func (*PubNub) CreatePushPayloadWithContext ¶
func (*PubNub) CreateSpace ¶
func (pn *PubNub) CreateSpace() *createSpaceBuilder
func (*PubNub) CreateSpaceWithContext ¶
func (*PubNub) CreateUser ¶
func (pn *PubNub) CreateUser() *createUserBuilder
func (*PubNub) CreateUserWithContext ¶
func (*PubNub) DeleteChannelGroup ¶
func (pn *PubNub) DeleteChannelGroup() *deleteChannelGroupBuilder
func (*PubNub) DeleteChannelGroupWithContext ¶
func (*PubNub) DeleteMessages ¶
func (pn *PubNub) DeleteMessages() *historyDeleteBuilder
func (*PubNub) DeleteMessagesWithContext ¶
func (*PubNub) DeleteSpace ¶
func (pn *PubNub) DeleteSpace() *deleteSpaceBuilder
func (*PubNub) DeleteSpaceWithContext ¶
func (*PubNub) DeleteUser ¶
func (pn *PubNub) DeleteUser() *deleteUserBuilder
func (*PubNub) DeleteUserWithContext ¶
func (*PubNub) FetchWithContext ¶
func (*PubNub) FireWithContext ¶
func (*PubNub) GetListeners ¶
func (*PubNub) GetMembers ¶
func (pn *PubNub) GetMembers() *getMembersBuilder
func (*PubNub) GetMembersWithContext ¶
func (*PubNub) GetMemberships ¶
func (pn *PubNub) GetMemberships() *getMembershipsBuilder
func (*PubNub) GetMembershipsWithContext ¶
func (*PubNub) GetMessageActions ¶
func (pn *PubNub) GetMessageActions() *getMessageActionsBuilder
func (*PubNub) GetMessageActionsWithContext ¶
func (*PubNub) GetSpaceWithContext ¶
func (*PubNub) GetSpacesWithContext ¶
func (*PubNub) GetStateWithContext ¶
func (*PubNub) GetSubscribeClient ¶
GetSubscribeClient Get a client for transactional requests
func (*PubNub) GetSubscribedChannels ¶
func (*PubNub) GetSubscribedGroups ¶
func (*PubNub) GetToken ¶
func (pn *PubNub) GetToken(resourceId string, resourceType PNResourceType) string
func (*PubNub) GetTokens ¶
func (pn *PubNub) GetTokens() GrantResourcesWithPermissions
func (*PubNub) GetTokensByResource ¶
func (pn *PubNub) GetTokensByResource(resourceType PNResourceType) GrantResourcesWithPermissions
func (*PubNub) GetUserWithContext ¶
func (*PubNub) GetUsersWithContext ¶
func (*PubNub) GrantToken ¶
func (pn *PubNub) GrantToken() *grantTokenBuilder
func (*PubNub) GrantTokenWithContext ¶
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) ListPushProvisions ¶
func (pn *PubNub) ListPushProvisions() *listPushProvisionsRequestBuilder
func (*PubNub) ListPushProvisionsWithContext ¶
func (*PubNub) ManageMembers ¶
func (pn *PubNub) ManageMembers() *manageMembersBuilder
func (*PubNub) ManageMembersWithContext ¶
func (*PubNub) ManageMemberships ¶
func (pn *PubNub) ManageMemberships() *manageMembershipsBuilder
func (*PubNub) ManageMembershipsWithContext ¶
func (*PubNub) MessageCounts ¶
func (pn *PubNub) MessageCounts() *messageCountsBuilder
func (*PubNub) MessageCountsWithContext ¶
func (*PubNub) PresenceWithContext ¶
func (*PubNub) PublishWithContext ¶
func (*PubNub) RemoveAllPushNotifications ¶
func (pn *PubNub) RemoveAllPushNotifications() *removeAllPushChannelsForDeviceBuilder
func (*PubNub) RemoveAllPushNotificationsWithContext ¶
func (*PubNub) RemoveChannelFromChannelGroup ¶
func (pn *PubNub) RemoveChannelFromChannelGroup() *removeChannelFromChannelGroupBuilder
func (*PubNub) RemoveChannelFromChannelGroupWithContext ¶
func (*PubNub) RemoveListener ¶
func (*PubNub) RemoveMessageAction ¶
func (pn *PubNub) RemoveMessageAction() *removeMessageActionsBuilder
func (*PubNub) RemoveMessageActionWithContext ¶
func (*PubNub) RemovePushNotificationsFromChannels ¶
func (pn *PubNub) RemovePushNotificationsFromChannels() *removeChannelsFromPushBuilder
func (*PubNub) RemovePushNotificationsFromChannelsWithContext ¶
func (*PubNub) ResetTokenManager ¶
func (pn *PubNub) ResetTokenManager()
func (*PubNub) SetStateWithContext ¶
func (*PubNub) SetSubscribeClient ¶
func (*PubNub) SignalWithContext ¶
func (*PubNub) TimeWithContext ¶
func (*PubNub) Unsubscribe ¶
func (pn *PubNub) Unsubscribe() *unsubscribeBuilder
func (*PubNub) UnsubscribeAll ¶
func (pn *PubNub) UnsubscribeAll()
func (*PubNub) UpdateSpace ¶
func (pn *PubNub) UpdateSpace() *updateSpaceBuilder
func (*PubNub) UpdateSpaceWithContext ¶
func (*PubNub) UpdateUser ¶
func (pn *PubNub) UpdateUser() *updateUserBuilder
func (*PubNub) UpdateUserWithContext ¶
func (*PubNub) WhereNowWithContext ¶
type PublishResponse ¶
type PublishResponse struct {
Timestamp int64
}
PublishResponse is the response after the execution on Publish and Fire operations.
type ReconnectionManager ¶
type ReconnectionManager struct { sync.RWMutex ExponentialMultiplier int FailedCalls int Milliseconds int OnReconnection func() OnMaxReconnectionExhaustion func() DoneTimer chan bool // contains filtered or unexported fields }
ReconnectionManager is used to store the properties required in running the Reconnection Manager.
func (*ReconnectionManager) HandleOnMaxReconnectionExhaustion ¶
func (m *ReconnectionManager) HandleOnMaxReconnectionExhaustion(handler func())
HandleOnMaxReconnectionExhaustion sets the handler that will be called when the max reconnection attempts are exhausted.
func (*ReconnectionManager) HandleReconnection ¶
func (m *ReconnectionManager) HandleReconnection(handler func())
HandleReconnection sets the handler that will be called when the network reconnects after a disconnect.
type ReconnectionPolicy ¶
type ReconnectionPolicy int
ReconnectionPolicy is used as an enum to catgorize the reconnection policies
const ( // PNNonePolicy is to be used when selecting the no Reconnection Policy // ReconnectionPolicy is set in the config. PNNonePolicy ReconnectionPolicy = 1 + iota // PNLinearPolicy is to be used when selecting the Linear Reconnection Policy // ReconnectionPolicy is set in the config. PNLinearPolicy // PNExponentialPolicy is to be used when selecting the Exponential Reconnection Policy // ReconnectionPolicy is set in the config. PNExponentialPolicy )
type RemoveAllPushChannelsForDeviceResponse ¶
type RemoveAllPushChannelsForDeviceResponse struct{}
RemoveAllPushChannelsForDeviceResponse is the struct returned when the Execute function of RemoveAllPushNotifications is called.
type RemoveChannelFromChannelGroupResponse ¶
type RemoveChannelFromChannelGroupResponse struct { }
RemoveChannelFromChannelGroupResponse is the struct returned when the Execute function of RemoveChannelFromChannelGroup is called.
type RemoveChannelsFromPushResponse ¶
type RemoveChannelsFromPushResponse struct{}
RemoveChannelsFromPushResponse is the struct returned when the Execute function of RemovePushNotificationsFromChannels is called.
type RequestWorkers ¶
type RequestWorkers struct { Workers []Worker WorkersChannel chan chan *JobQItem MaxWorkers int Sem chan bool }
func (*RequestWorkers) ReadQueue ¶
func (p *RequestWorkers) ReadQueue(pubnub *PubNub)
ReadQueue reads the queue and passes on the job to the workers
func (*RequestWorkers) Start ¶
func (p *RequestWorkers) Start(pubnub *PubNub, ctx Context)
Start starts the workers
type ResourcePermissions ¶
ResourcePermissions contains all the applicable perms for bitmask translations.
type ResponseInfo ¶
type ResponseInfo struct { Operation OperationType StatusCode int TLSEnabled bool Origin string UUID string AuthKey string OriginalResponse *http.Response }
ResponseInfo is used to store the properties in the response of an request.
type SetStateResponse ¶
type SetStateResponse struct { State interface{} Message string }
SetStateResponse is the response returned when the Execute function of SetState is called.
type SignalResponse ¶
type SignalResponse struct {
Timestamp int64
}
SignalResponse is the response to Signal request.
type StateManager ¶
StateManager is used to store the subscriptions types
type StateOperation ¶
type StateOperation struct {
// contains filtered or unexported fields
}
type StatusCategory ¶
type StatusCategory int
StatusCategory is used as an enum to catgorize the various status events in the APIs lifecycle
const ( // PNUnknownCategory as the StatusCategory means an unknown status category event occurred. PNUnknownCategory StatusCategory = 1 + iota // PNTimeoutCategory as the StatusCategory means the request timeout has reached. PNTimeoutCategory // PNConnectedCategory as the StatusCategory means the channel is subscribed to receive messages. PNConnectedCategory // PNDisconnectedCategory as the StatusCategory means a disconnection occurred due to network issues. PNDisconnectedCategory // PNCancelledCategory as the StatusCategory means the context was cancelled. PNCancelledCategory // PNLoopStopCategory as the StatusCategory means the subscribe loop was stopped. PNLoopStopCategory // PNAcknowledgmentCategory as the StatusCategory is the Acknowledgement of an operation (like Unsubscribe). PNAcknowledgmentCategory // PNBadRequestCategory as the StatusCategory means the request was malformed. PNBadRequestCategory // PNAccessDeniedCategory as the StatusCategory means that PAM is enabled and the channel is not granted R/W access. PNAccessDeniedCategory // PNNoStubMatchedCategory as the StatusCategory means an unknown status category event occurred. PNNoStubMatchedCategory // PNReconnectedCategory as the StatusCategory means that the network was reconnected (after a disconnection). // Applicable on for PNLinearPolicy and PNExponentialPolicy. PNReconnectedCategory // PNReconnectionAttemptsExhausted as the StatusCategory means that the reconnection attempts // to reconnect to the network were exhausted. All channels would be unsubscribed at this point. // Applicable on for PNLinearPolicy and PNExponentialPolicy. // Reconnection attempts are set in the config: MaximumReconnectionRetries. PNReconnectionAttemptsExhausted // PNRequestMessageCountExceededCategory is fired when the MessageQueueOverflowCount limit is exceeded by the number of messages received in a single subscribe request PNRequestMessageCountExceededCategory )
func (StatusCategory) String ¶
func (c StatusCategory) String() string
type StatusResponse ¶
type StatusResponse struct { Error error Category StatusCategory Operation OperationType StatusCode int TLSEnabled bool UUID string AuthKey string Origin string OriginalResponse string Request string AffectedChannels []string AffectedChannelGroups []string }
StatusResponse is used to store the usable properties in the response of an request.
type SubscribeOperation ¶
type SubscribeOperation struct { Channels []string ChannelGroups []string PresenceEnabled bool Timetoken int64 FilterExpression string State map[string]interface{} QueryParam map[string]string }
SubscribeOperation
type SubscriptionItem ¶
type SubscriptionItem struct {
// contains filtered or unexported fields
}
SubscriptionItem is used to store the subscription item's properties.
type SubscriptionManager ¶
Heartbeat: - Heartbeat is enabled by default. - Default presence timeout is 0 seconds. - The first Heartbeat request will be scheduled to be executed after getHeartbeatInterval() seconds (default - 149).
func (*SubscriptionManager) AddListener ¶
func (m *SubscriptionManager) AddListener(listener *Listener)
func (*SubscriptionManager) Destroy ¶
func (m *SubscriptionManager) Destroy()
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 TelemetryManager ¶
type TelemetryManager struct { sync.RWMutex IsRunning bool // contains filtered or unexported fields }
TelemetryManager is the struct to store the Telemetry details.
func (*TelemetryManager) CleanUpTelemetryData ¶
func (m *TelemetryManager) CleanUpTelemetryData()
CleanUpTelemetryData cleans up telemetry data of all operations.
func (*TelemetryManager) OperationLatency ¶
func (m *TelemetryManager) OperationLatency() map[string]string
OperationLatency returns a map of the stored latencies by operation.
func (*TelemetryManager) StoreLatency ¶
func (m *TelemetryManager) StoreLatency(latency float64, t OperationType)
StoreLatency stores the latency values of the different operations.
type TimeResponse ¶
type TimeResponse struct {
Timetoken int64
}
TimeResponse is the response when Time call is executed.
type TokenManager ¶
type TokenManager struct { sync.RWMutex Tokens GrantResourcesWithPermissions // contains filtered or unexported fields }
TokenManager struct is used to for token manager operations
func (*TokenManager) GetAllTokens ¶
func (m *TokenManager) GetAllTokens() GrantResourcesWithPermissions
GetAllTokens retrieves all the tokens from the token manager
func (*TokenManager) GetToken ¶
func (m *TokenManager) GetToken(resourceID string, resourceType PNResourceType) string
GetToken first match for direct ids, if no match found use the first token from pattern match ignoring the regex (by design).
func (*TokenManager) GetTokensByResource ¶
func (m *TokenManager) GetTokensByResource(resourceType PNResourceType) GrantResourcesWithPermissions
GetTokensByResource retrieves the tokens by PNResourceType from the token manager
func (*TokenManager) SetAuthParan ¶
func (m *TokenManager) SetAuthParan(q *url.Values, resourceID string, resourceType PNResourceType)
SetAuthParan sets the auth param in the requests by retrieving the corresponding tokens from the token manager
func (*TokenManager) StoreToken ¶
func (m *TokenManager) StoreToken(token string)
StoreToken Aceepts PAMv3 token format token to store in the token manager
func (*TokenManager) StoreTokens ¶
func (m *TokenManager) StoreTokens(token []string)
StoreTokens Aceepts PAMv3 token format tokens to store in the token manager
type UnsubscribeOperation ¶
type UpdateSpaceBody ¶
type UpdateSpaceBody struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Custom map[string]interface{} `json:"custom"` }
UpdateSpaceBody is the input to update space
type UpdateUserBody ¶
type UpdateUserBody struct { ID string `json:"id"` Name string `json:"name"` ExternalID string `json:"externalId"` ProfileURL string `json:"profileUrl"` Email string `json:"email"` Custom map[string]interface{} `json:"custom"` }
UpdateUserBody is the input to update user
type UserSpacePermissions ¶
UserSpacePermissions contains all the acceptable perms for Users and Spaces
type UserSpacePermissionsWithToken ¶
type UserSpacePermissionsWithToken struct { Permissions UserSpacePermissions BitMaskPerms int64 Token string Timestamp int64 TTL int }
UserSpacePermissionsWithToken is used for users/spaces resource type permissions
type WhereNowResponse ¶
type WhereNowResponse struct {
Channels []string
}
WhereNowResponse is the response of the WhereNow request. Contains channels info.
Source Files ¶
- add_channel_channel_group_request.go
- add_channels_to_push_request.go
- clients.go
- config.go
- context.go
- delete_channel_group_request.go
- endpoints.go
- enums.go
- fetch_request.go
- fire_request.go
- get_state_request.go
- grant_common.go
- grant_request.go
- grant_token_request.go
- heartbeat_manager.go
- heartbeat_request.go
- here_now_request.go
- history_delete_request.go
- history_request.go
- leave_request.go
- list_all_channel_group_request.go
- list_push_provisions_request.go
- listener_manager.go
- message_actions_add.go
- message_actions_get.go
- message_actions_remove.go
- message_counts_request.go
- objects_common.go
- objects_create_space.go
- objects_create_user.go
- objects_delete_space.go
- objects_delete_user.go
- objects_get_members.go
- objects_get_memberships.go
- objects_get_space.go
- objects_get_spaces.go
- objects_get_user.go
- objects_get_users.go
- objects_manage_members.go
- objects_manage_memberships.go
- objects_update_space.go
- objects_update_user.go
- presence_request.go
- publish_push_helper.go
- publish_request.go
- pubnub.go
- reconnection_manager.go
- remove_all_push_channels_request.go
- remove_channel_channel_group_request.go
- remove_channels_from_push_request.go
- request.go
- request_context.go
- request_workers.go
- set_state_request.go
- signal_request.go
- state_manager.go
- subscribe_context_helper_1_7.go
- subscribe_request.go
- subscription_manager.go
- telemetry_manager.go
- time_request.go
- token_manager.go
- unsubscribe_builder.go
- where_now_request.go