webpubsub

package module
v7.0.0-...-bf57de9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 25 Imported by: 1

README

WebPubSub Go SDK

GoDoc Build Status codecov.io Go Report Card

This is the official WebPubSub Go SDK repository.

WebPubSub takes care of the infrastructure and APIs needed for the realtime communication layer of your application. Work on your app's logic and let WebPubSub handle sending and receiving data across the world in less than 100ms.

Requirements

  • Go (1.9+)

Get keys

You will need the publish and subscribe keys to authenticate your app. Get your keys from the Admin Portal.

Configure WebPubSub

  1. Integrate WebPubSub into your project using the go command:

    go get github.com/webpubsub/sdk-go
    

    If you encounter dependency issues, use the dep ensure command to resolve them.

  2. Create a new file and add the following code:

    func main() {
        config := webpubsub.NewConfig()
        config.SubscribeKey = "mySubscribeKey"
        config.PublishKey = "myPublishKey"
        config.UUID = "myUniqueUUID"
    
        pn := webpubsub.NewWebPubSub(config)
    }
    

Add event listeners

listener := webpubsub.NewListener()
doneConnect := make(chan bool)
donePublish := make(chan bool)

msg := map[string]interface{}{
    "msg": "Hello world",
}
go func() {
    for {
        select {
        case status := <-listener.Status:
            switch status.Category {
            case webpubsub.WPSDisconnectedCategory:
                // This event happens when radio / connectivity is lost
            case webpubsub.WPSConnectedCategory:
                // Connect event. You can do stuff like publish, and know you'll get it.
                // Or just use the connected event to confirm you are subscribed for
                // UI / internal notifications, etc
                doneConnect <- true
            case webpubsub.WPSReconnectedCategory:
                // Happens as part of our regular operation. This event happens when
                // radio / connectivity is lost, then regained.
            }
        case message := <-listener.Message:
            // Handle new message stored in message.message
            if message.Channel != "" {
                // Message has been received on channel group stored in
                // message.Channel
            } else {
                // Message has been received on channel stored in
                // message.Subscription
            }
            if msg, ok := message.Message.(map[string]interface{}); ok {
                fmt.Println(msg["msg"])
            }
            /*
                log the following items with your favorite logger
                    - message.Message
                    - message.Subscription
                    - message.Timetoken
            */

            donePublish <- true
        case <-listener.Presence:
            // handle presence
        }
    }
}()

pn.AddListener(listener)

Publish and subscribe

In this code, publishing a message is triggered when the subscribe call is finished successfully. The Publish() method uses the msg variable that is used in the following code.

msg := map[string]interface{}{
        "msg": "Hello world!"
}

pn.Subscribe().
    Channels([]string{"hello_world"}).
    Execute()

<-doneConnect

response, status, err := pn.Publish().
    Channel("hello_world").Message(msg).Execute()

if err != nil {
     // Request processing failed.
     // Handle message publish error
}

Documentation

API reference for Go

Support

If you need help or have a general question, contact support@webpubsub.com.

Documentation

Index

Constants

View Source
const (
	// WPSObjectsMembershipEvent is the enum when the event of type `membership` occurs
	WPSObjectsMembershipEvent WPSObjectsEventType = "membership"
	// WPSObjectsChannelEvent is the enum when the event of type `channel` occurs
	WPSObjectsChannelEvent = "channel"
	// WPSObjectsUUIDEvent is the enum when the event of type `uuid` occurs
	WPSObjectsUUIDEvent = "uuid"
	// WPSObjectsNoneEvent is used for error handling
	WPSObjectsNoneEvent = "none"
)
View Source
const (
	// WPSRead Read Perms
	WPSRead WPSGrantBitMask = 1
	// WPSWrite Write Perms
	WPSWrite = 2
	// WPSManage Manage Perms
	WPSManage = 4
	// WPSDelete Delete Perms
	WPSDelete = 8
	// WPSCreate Create Perms
	WPSCreate = 16
	// WPSGet Get Perms
	WPSGet = 32
	// WPSUpdate Update Perms
	WPSUpdate = 64
	// WPSJoin Join Perms
	WPSJoin = 128
)
View Source
const (
	// Version :the version of the SDK
	Version = "7.0.3"
	// MaxSequence for publish messages
	MaxSequence = 65535
)

Default constants

View Source
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"
	// StrMissingFileID shows `Missing File ID` message
	StrMissingFileID = "Missing File ID"
	// StrMissingFileName shows `Missing File Name` message
	StrMissingFileName = "Missing File Name"
	// StrMissingToken shows `Missing PAMv3 token` message
	StrMissingToken = "Missing PAMv3 token"
)

Variables

This section is empty.

Functions

func EnumArrayToStringArray

func EnumArrayToStringArray(include interface{}) []string

EnumArrayToStringArray converts a string enum to an array

func GenerateUUID

func GenerateUUID() string

func NewHTTP1Client

func NewHTTP1Client(connectTimeout, responseReadTimeout, maxIdleConnsPerHost int) *http.Client

NewHTTP1Client creates a new HTTP 1 client with a new transport initialized with connect and read timeout

func NewHTTP2Client

func NewHTTP2Client(connectTimeout int, responseReadTimeout int) *http.Client

NewHTTP2Client creates a new HTTP 2 client with a new transport initialized with connect and read timeout

func ParseFileInfo

func ParseFileInfo(filesPayload map[string]interface{}) (WPSFileDetails, WPSPublishMessage)

ParseFileInfo is a function extract file info and add to the struct WPSFileMessageAndDetails

func SetArrayTypeQueryParam

func SetArrayTypeQueryParam(q *url.Values, val []string, key string)

SetArrayTypeQueryParam appends to the query string the key val pair

func SetPushEnvironment

func SetPushEnvironment(q *url.Values, env WPSPushEnvironment)

SetPushEnvironment appends the push environment to the query string

func SetPushTopic

func SetPushTopic(q *url.Values, topic string)

SetPushTopic appends the topic to the query string

func SetQueryParam

func SetQueryParam(q *url.Values, queryParam map[string]string)

SetQueryParam appends the query params map to the query string

func SetQueryParamAsCommaSepString

func SetQueryParamAsCommaSepString(q *url.Values, val []string, key string)

SetQueryParamAsCommaSepString appends to the query string the comma separated 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

type AllChannelGroupResponse struct {
	Channels     []string
	ChannelGroup string
}

AllChannelGroupResponse is the struct returned when the Execute function of List All Channel Groups is called.

type ChannelPermissions

type ChannelPermissions struct {
	Read   bool
	Write  bool
	Delete bool
	Get    bool
	Manage bool
	Update bool
	Join   bool
}

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.
	CipherKey                     string             // If CipherKey is passed, all communications to/from WebPubSub 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
	FileUploadRequestTimeout      int                // http.Client.Timeout File Upload Request 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.
	WPSReconnectionPolicy         ReconnectionPolicy // Reconnection policy selection
	Log                           *log.Logger        // Logger instance
	SuppressLeaveEvents           bool               // When true the SDK doesn't send out the leave requests.
	DisableWPSOtherProcessing     bool               // WPSOther 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 WPSRequestMessageCountExceededCategory 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.
	FileMessagePublishRetryLimit  int                // The number of tries made in case of Publish File Message failure.
	UseRandomInitializationVector bool               // When true the IV will be random for all requests and not just file upload. When false the IV will be hardcoded for all requests except File Upload
}

Config instance is storage for user-provided information which describe further WebPubSub client behaviour. Configuration instance contain additional set of properties which allow to perform precise WebPubSub client configuration.

func NewConfig

func NewConfig(uuid string) *Config

NewConfig initiates the config with default values.

func NewDemoConfig

func NewDemoConfig() *Config

NewDemoConfig initiates the config with demo keys, for tests only.

func (*Config) SetPresenceTimeout

func (c *Config) SetPresenceTimeout(timeout int) *Config

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

func (c *Config) SetPresenceTimeoutWithCustomInterval(
	timeout, interval int) *Config

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 Context

type Context interface {
	Deadline() (deadline time.Time, ok bool)
	Done() <-chan struct{}
	Err() error
	Value(key interface{}) interface{}
}

Context interface

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]WPSHistoryMessageActionsTypeMap `json:"actions"`
	File           WPSFileDetails                             `json:"file"`
	Timetoken      string                                     `json:"timetoken"`
	UUID           string                                     `json:"uuid"`
	MessageType    int                                        `json:"message_type"`
}

FetchResponseItem contains the message and the associated timetoken.

type GetStateResponse

type GetStateResponse struct {
	State map[string]interface{}
	UUID  string
}

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"`
	UUIDs    map[string]int64 `json:"uuids" cbor:"uuid"`
	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
	ChannelsPattern map[string]ChannelPermissionsWithToken
	GroupsPattern   map[string]GroupPermissionsWithToken
}

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]*WPSPAMEntityData
	ChannelGroups map[string]*WPSPAMEntityData
	UUIDs         map[string]*WPSPAMEntityData

	ReadEnabled   bool
	WriteEnabled  bool
	ManageEnabled bool
	DeleteEnabled bool
	GetEnabled    bool
	UpdateEnabled bool
	JoinEnabled   bool
}

GrantResponse is the struct returned when the Execute function of Grant is called.

type GroupPermissions

type GroupPermissions struct {
	Read   bool
	Manage bool
}

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

type HeartbeatManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

type HereNowOccupantsData struct {
	UUID string

	State map[string]interface{}
}

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
}

JobQItem is the type to store the request, client and its resposne.

type JobQResponse

type JobQResponse struct {
	Resp  *http.Response
	Error error
}

JobQResponse is the type to store the resposne and error of the requests in the queue.

type LatencyEntry

type LatencyEntry struct {
	D int64
	L float64
}

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 *WPSStatus
	Message             chan *WPSMessage
	Presence            chan *WPSPresence
	Signal              chan *WPSMessage
	UUIDEvent           chan *WPSUUIDEvent
	ChannelEvent        chan *WPSChannelEvent
	MembershipEvent     chan *WPSMembershipEvent
	MessageActionsEvent chan *WPSMessageActionsEvent
	File                chan *WPSFilesEvent
}

Listener type has all the `types` of response events

func NewListener

func NewListener() *Listener

NewListener initates the listener to facilitate the event handling

type ListenerManager

type ListenerManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ListenerManager is used in the internal handling of listeners.

type MessageAction

type MessageAction struct {
	ActionType  string `json:"type"`
	ActionValue string `json:"value"`
}

MessageAction struct is used to create a Message Action

type MessageCountsResponse

type MessageCountsResponse struct {
	Channels map[string]int
}

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 (
	// WPSSubscribeOperation is the enum used for the Subcribe operation.
	WPSSubscribeOperation OperationType = 1 + iota
	// WPSUnsubscribeOperation is the enum used for the Unsubcribe operation.
	WPSUnsubscribeOperation
	// WPSPublishOperation is the enum used for the Publish operation.
	WPSPublishOperation
	// WPSFireOperation is the enum used for the Fire operation.
	WPSFireOperation
	// WPSHistoryOperation is the enum used for the History operation.
	WPSHistoryOperation
	// WPSFetchMessagesOperation is the enum used for the Fetch operation.
	WPSFetchMessagesOperation
	// WPSWhereNowOperation is the enum used for the Where Now operation.
	WPSWhereNowOperation
	// WPSHereNowOperation is the enum used for the Here Now operation.
	WPSHereNowOperation
	// WPSHeartBeatOperation is the enum used for the Heartbeat operation.
	WPSHeartBeatOperation
	// WPSSetStateOperation is the enum used for the Set State operation.
	WPSSetStateOperation
	// WPSGetStateOperation is the enum used for the Get State operation.
	WPSGetStateOperation
	// WPSAddChannelsToChannelGroupOperation is the enum used for the Add Channels to Channel Group operation.
	WPSAddChannelsToChannelGroupOperation
	// WPSRemoveChannelFromChannelGroupOperation is the enum used for the Remove Channels from Channel Group operation.
	WPSRemoveChannelFromChannelGroupOperation
	// WPSRemoveGroupOperation is the enum used for the Remove Channel Group operation.
	WPSRemoveGroupOperation
	// WPSChannelsForGroupOperation is the enum used for the List Channels of Channel Group operation.
	WPSChannelsForGroupOperation
	// WPSPushNotificationsEnabledChannelsOperation is the enum used for the List Channels with Push Notifications enabled operation.
	WPSPushNotificationsEnabledChannelsOperation
	// WPSAddPushNotificationsOnChannelsOperation is the enum used for the Add Channels to Push Notifications operation.
	WPSAddPushNotificationsOnChannelsOperation
	// WPSRemovePushNotificationsFromChannelsOperation is the enum used for the Remove Channels from Push Notifications operation.
	WPSRemovePushNotificationsFromChannelsOperation
	// WPSRemoveAllPushNotificationsOperation is the enum used for the Remove All Channels from Push Notifications operation.
	WPSRemoveAllPushNotificationsOperation
	// WPSTimeOperation is the enum used for the Time operation.
	WPSTimeOperation
	// WPSAccessManagerGrant is the enum used for the Access Manager Grant operation.
	WPSAccessManagerGrant
	// WPSAccessManagerRevoke is the enum used for the Access Manager Revoke operation.
	WPSAccessManagerRevoke
	// WPSDeleteMessagesOperation is the enum used for the Delete Messages from History operation.
	WPSDeleteMessagesOperation
	// WPSMessageCountsOperation is the enum used for History with messages operation.
	WPSMessageCountsOperation
	// WPSSignalOperation is the enum used for Signal opertaion.
	WPSSignalOperation
	// WPSCreateUserOperation is the enum used to create users in the Object API.
	// ENUM ORDER needs to be maintained for Objects AIP
	WPSCreateUserOperation
	// WPSGetUsersOperation is the enum used to get users in the Object API.
	WPSGetUsersOperation
	// WPSGetUserOperation is the enum used to get user in the Object API.
	WPSGetUserOperation
	// WPSUpdateUserOperation is the enum used to update users in the Object API.
	WPSUpdateUserOperation
	// WPSDeleteUserOperation is the enum used to delete users in the Object API.
	WPSDeleteUserOperation
	// WPSGetSpaceOperation is the enum used to get space in the Object API.
	WPSGetSpaceOperation
	// WPSGetSpacesOperation is the enum used to get spaces in the Object API.
	WPSGetSpacesOperation
	// WPSCreateSpaceOperation is the enum used to create space in the Object API.
	WPSCreateSpaceOperation
	// WPSDeleteSpaceOperation is the enum used to delete space in the Object API.
	WPSDeleteSpaceOperation
	// WPSUpdateSpaceOperation is the enum used to update space in the Object API.
	WPSUpdateSpaceOperation
	// WPSGetMembershipsOperation is the enum used to get memberships in the Object API.
	WPSGetMembershipsOperation
	// WPSGetChannelMembersOperation is the enum used to get members in the Object API.
	WPSGetChannelMembersOperation
	// WPSManageMembershipsOperation is the enum used to manage memberships in the Object API.
	WPSManageMembershipsOperation
	// WPSManageMembersOperation is the enum used to manage members in the Object API.
	// ENUM ORDER needs to be maintained for Objects API.
	WPSManageMembersOperation
	// WPSSetChannelMembersOperation is the enum used to Set Members in the Object API.
	WPSSetChannelMembersOperation
	// WPSSetMembershipsOperation is the enum used to Set Memberships in the Object API.
	WPSSetMembershipsOperation
	// WPSRemoveChannelMetadataOperation is the enum used to Remove Channel Metadata in the Object API.
	WPSRemoveChannelMetadataOperation
	// WPSRemoveUUIDMetadataOperation is the enum used to Remove UUID Metadata in the Object API.
	WPSRemoveUUIDMetadataOperation
	// WPSGetAllChannelMetadataOperation is the enum used to Get All Channel Metadata in the Object API.
	WPSGetAllChannelMetadataOperation
	// WPSGetAllUUIDMetadataOperation is the enum used to Get All UUID Metadata in the Object API.
	WPSGetAllUUIDMetadataOperation
	// WPSGetUUIDMetadataOperation is the enum used to Get UUID Metadata in the Object API.
	WPSGetUUIDMetadataOperation
	// WPSRemoveMembershipsOperation is the enum used to Remove Memberships in the Object API.
	WPSRemoveMembershipsOperation
	// WPSRemoveChannelMembersOperation is the enum used to Remove Members in the Object API.
	WPSRemoveChannelMembersOperation
	// WPSSetUUIDMetadataOperation is the enum used to Set UUID Metadata in the Object API.
	WPSSetUUIDMetadataOperation
	// WPSSetChannelMetadataOperation is the enum used to Set Channel Metadata in the Object API.
	WPSSetChannelMetadataOperation
	// WPSGetChannelMetadataOperation is the enum used to Get Channel Metadata in the Object API.
	WPSGetChannelMetadataOperation
	// WPSAccessManagerGrantToken is the enum used for Grant v3 requests.
	WPSAccessManagerGrantToken
	// WPSGetMessageActionsOperation is the enum used for Message Actions Get requests.
	WPSGetMessageActionsOperation
	// WPSHistoryWithActionsOperation is the enum used for History with Actions requests.
	WPSHistoryWithActionsOperation
	// WPSAddMessageActionsOperation is the enum used for Message Actions Add requests.
	WPSAddMessageActionsOperation
	// WPSRemoveMessageActionsOperation is the enum used for Message Actions Remove requests.
	WPSRemoveMessageActionsOperation
	// WPSDeleteFileOperation is the enum used for DeleteFile requests.
	WPSDeleteFileOperation
	// WPSDownloadFileOperation is the enum used for DownloadFile requests.
	WPSDownloadFileOperation
	// WPSGetFileURLOperation is the enum used for GetFileURL requests.
	WPSGetFileURLOperation
	// WPSListFilesOperation is the enum used for ListFiles requests.
	WPSListFilesOperation
	// WPSSendFileOperation is the enum used for SendFile requests.
	WPSSendFileOperation
	// WPSSendFileToS3Operation is the enum used for v requests.
	WPSSendFileToS3Operation
	// WPSPublishFileMessageOperation is the enum used for PublishFileMessage requests.
	WPSPublishFileMessageOperation
	// WPSAccessManagerRevokeToken is the enum used for Grant Token remove requests.
	WPSAccessManagerRevokeToken
)

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 PermissionsBody

type PermissionsBody struct {
	Resources      GrantResources         `json:"resources"`
	Patterns       GrantResources         `json:"patterns"`
	Meta           map[string]interface{} `json:"meta"`
	AuthorizedUUID string                 `json:"uuid,omitempty"`
}

PermissionsBody is the struct used to decode the server response

type PublishFileMessageResponse

type PublishFileMessageResponse struct {
	Timestamp int64
}

PublishFileMessageResponse is the response to PublishFileMessage request.

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 (
	// WPSNonePolicy is to be used when selecting the no Reconnection Policy
	// ReconnectionPolicy is set in the config.
	WPSNonePolicy ReconnectionPolicy = 1 + iota
	// WPSLinearPolicy is to be used when selecting the Linear Reconnection Policy
	// ReconnectionPolicy is set in the config.
	WPSLinearPolicy
	// WPSExponentialPolicycy is to be used when selecting the Exponential Reconnection Policy
	// ReconnectionPolicy is set in the config.
	WPSExponentialPolicycy
)

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
}

RequestWorkers is the type to store the workers info

func (*RequestWorkers) Close

func (p *RequestWorkers) Close()

Close closes the workers

func (*RequestWorkers) ReadQueue

func (p *RequestWorkers) ReadQueue(webpubsub *WebPubSub)

ReadQueue reads the queue and passes on the job to the workers

func (*RequestWorkers) Start

func (p *RequestWorkers) Start(webpubsub *WebPubSub, ctx Context)

Start starts the workers

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 SetChannelMetadataBody

type SetChannelMetadataBody struct {
	Name        string                 `json:"name,omitempty"`
	Description string                 `json:"description,omitempty"`
	Custom      map[string]interface{} `json:"custom,omitempty"`
}

SetChannelMetadataBody is the input to update space

type SetStateResponse

type SetStateResponse struct {
	State   interface{}
	Message string
}

SetStateResponse is the response returned when the Execute function of SetState is called.

type SetUUIDMetadataBody

type SetUUIDMetadataBody struct {
	Name       string                 `json:"name,omitempty"`
	ExternalID string                 `json:"externalId,omitempty"`
	ProfileURL string                 `json:"profileUrl,omitempty"`
	Email      string                 `json:"email,omitempty"`
	Custom     map[string]interface{} `json:"custom,omitempty"`
}

SetUUIDMetadataBody is the input to update user

type SignalResponse

type SignalResponse struct {
	Timestamp int64
}

SignalResponse is the response to Signal request.

type StateManager

type StateManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

StateManager is used to store the subscriptions types

type StateOperation

type StateOperation struct {
	// contains filtered or unexported fields
}

StateOperation is the types to store state op params

type StatusCategory

type StatusCategory int

StatusCategory is used as an enum to catgorize the various status events in the APIs lifecycle

const (
	// WPSUnknownCategory as the StatusCategory means an unknown status category event occurred.
	WPSUnknownCategory StatusCategory = 1 + iota
	// WPSTimeoutCategory as the StatusCategory means the request timeout has reached.
	WPSTimeoutCategory
	// WPSConnectedCategory as the StatusCategory means the channel is subscribed to receive messages.
	WPSConnectedCategory
	// WPSDisconnectedCategory as the StatusCategory means a disconnection occurred due to network issues.
	WPSDisconnectedCategory
	// WPSCancelledCategory as the StatusCategory means the context was cancelled.
	WPSCancelledCategory
	// WPSLoopStopCategory as the StatusCategory means the subscribe loop was stopped.
	WPSLoopStopCategory
	// WPSAcknowledgmentCategory as the StatusCategory is the Acknowledgement of an operation (like Unsubscribe).
	WPSAcknowledgmentCategory
	// WPSBadRequestCategory as the StatusCategory means the request was malformed.
	WPSBadRequestCategory
	// WPSAccessDeniedCategory as the StatusCategory means that PAM is enabled and the channel is not granted R/W access.
	WPSAccessDeniedCategory
	// WPSNoStubMatchedCategory as the StatusCategory means an unknown status category event occurred.
	WPSNoStubMatchedCategory
	// WPSReconnectedCategory as the StatusCategory means that the network was reconnected (after a disconnection).
	// Applicable on for WPSLinearPolicy and WPSExponentialPolicycy.
	WPSReconnectedCategory
	// WPSReconnectionAttemptsExhausted 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 WPSLinearPolicy and WPSExponentialPolicycy.
	// Reconnection attempts are set in the config: MaximumReconnectionRetries.
	WPSReconnectionAttemptsExhausted
	// WPSRequestMessageCountExceededCategory is fired when the MessageQueueOverflowCount limit is exceeded by the number of messages received in a single subscribe request
	WPSRequestMessageCountExceededCategory
)

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
	AdditionalData        interface{}
}

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 is the type to store the subscribe op params

type SubscriptionItem

type SubscriptionItem struct {
	// contains filtered or unexported fields
}

SubscriptionItem is used to store the subscription item's properties.

type SubscriptionManager

type SubscriptionManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SubscriptionManager Events: - ConnectedCategory - after connection established - DisconnectedCategory - after subscription loop stops for any reason (no channels left or error happened) Unsubscribe When you unsubscribe from channel or channel group the following events happens: - LoopStopCategory - immediately when no more channels or channel groups left to subscribe - WPSUnsubscribeOperation - after leave request was fulfilled and server is notified about unsubscibed items Announcement: Status, Message and Presence announcement happens in a distinct goroutine. It doesn't block subscribe loop. Keep in mind that each listener will receive the same pointer to a response object. You may wish to create a shallow copy of either the response or the response message by you own to not affect the other listeners. 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)

AddListener adds a new listener.

func (*SubscriptionManager) Destroy

func (m *SubscriptionManager) Destroy()

Destroy closes the subscription manager, listeners and reconnection manager instances.

func (*SubscriptionManager) Disconnect

func (m *SubscriptionManager) Disconnect()

Disconnect stops all open subscribe requests, timers, heartbeats and unsubscribes from all channels

func (*SubscriptionManager) GetListeners

func (m *SubscriptionManager) GetListeners() map[*Listener]bool

GetListeners gets all the listeners.

func (*SubscriptionManager) RemoveAllListeners

func (m *SubscriptionManager) RemoveAllListeners()

RemoveAllListeners removes all the listeners.

func (*SubscriptionManager) RemoveListener

func (m *SubscriptionManager) RemoveListener(listener *Listener)

RemoveListener removes the 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
	Token string
}

TokenManager struct is used to for token manager operations

func (*TokenManager) CleanUp

func (m *TokenManager) CleanUp()

CleanUp resets the token manager

func (*TokenManager) GetToken

func (m *TokenManager) GetToken() string

func (*TokenManager) StoreToken

func (m *TokenManager) StoreToken(token string)

StoreToken Aceepts PAMv3 token format token to store in the token manager

type UUIDPermissions

type UUIDPermissions struct {
	Get    bool
	Update bool
	Delete bool
}

type UnsubscribeOperation

type UnsubscribeOperation struct {
	Channels      []string
	ChannelGroups []string
	QueryParam    map[string]string
}

UnsubscribeOperation is the types to store unsubscribe op params

type WPSAPNS2Data

type WPSAPNS2Data struct {
	CollapseID string          `json:"collapseId"`
	Expiration string          `json:"expiration"`
	Targets    []WPSPushTarget `json:"targets"`
	Version    string          `json:"version"`
}

WPSAPNS2Data is the struct used for the APNS2 paylod

type WPSAPNSData

type WPSAPNSData struct {
	APS    WPSAPSData `json:"aps"`
	Custom map[string]interface{}
}

WPSAPNSData is the struct used for the APNS paylod

type WPSAPSData

type WPSAPSData 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{}
}

WPSAPSData is the helper struct used for the APNS paylod

type WPSAccessManagerKeyData

type WPSAccessManagerKeyData struct {
	ReadEnabled   bool
	WriteEnabled  bool
	ManageEnabled bool
	DeleteEnabled bool
	GetEnabled    bool
	UpdateEnabled bool
	JoinEnabled   bool
	TTL           int
}

WPSAccessManagerKeyData is the struct containing the access details of the channel groups.

type WPSAddMessageActionsResponse

type WPSAddMessageActionsResponse struct {
	Data WPSMessageActionsResponse `json:"data"`
	// contains filtered or unexported fields
}

WPSAddMessageActionsResponse is the Add Message Actions API Response

type WPSChannel

type WPSChannel struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Updated     string                 `json:"updated"`
	ETag        string                 `json:"eTag"`
	Custom      map[string]interface{} `json:"custom"`
}

WPSChannel is the Objects API space struct

type WPSChannelEvent

type WPSChannelEvent struct {
	Event             WPSObjectsEvent
	ChannelID         string
	Description       string
	Timestamp         string
	Name              string
	Updated           string
	ETag              string
	Custom            map[string]interface{}
	SubscribedChannel string
	ActualChannel     string
	Channel           string
	Subscription      string
}

WPSChannelEvent is the Response for a Space Event

type WPSChannelMembers

type WPSChannelMembers struct {
	ID      string                 `json:"id"`
	UUID    WPSUUID                `json:"uuid"`
	Created string                 `json:"created"`
	Updated string                 `json:"updated"`
	ETag    string                 `json:"eTag"`
	Custom  map[string]interface{} `json:"custom"`
}

WPSChannelMembers is the Objects API Members struct

type WPSChannelMembersInclude

type WPSChannelMembersInclude int

WPSChannelMembersInclude is used as an enum to catgorize the available Members include types

const (
	// WPSChannelMembersIncludeCustom is the enum equivalent to the value `custom` available Members include types
	WPSChannelMembersIncludeCustom WPSChannelMembersInclude = 1 + iota
	// WPSChannelMembersIncludeUUID is the enum equivalent to the value `uuid` available Members include types
	WPSChannelMembersIncludeUUID
	// WPSChannelMembersIncludeUUIDCustom is the enum equivalent to the value `uuid.custom` available Members include types
	WPSChannelMembersIncludeUUIDCustom
)

func (WPSChannelMembersInclude) String

func (s WPSChannelMembersInclude) String() string

type WPSChannelMembersRemove

type WPSChannelMembersRemove struct {
	UUID WPSChannelMembersUUID `json:"uuid"`
}

WPSChannelMembersRemove is the Objects API Members struct used to remove members

type WPSChannelMembersRemoveChangeset

type WPSChannelMembersRemoveChangeset struct {
	Remove []WPSChannelMembersRemove `json:"delete"`
}

WPSChannelMembersRemoveChangeset is the Objects API input to add, remove or update membership

type WPSChannelMembersSet

type WPSChannelMembersSet struct {
	UUID   WPSChannelMembersUUID  `json:"uuid"`
	Custom map[string]interface{} `json:"custom"`
}

WPSChannelMembersSet is the Objects API Members input struct used to add members

type WPSChannelMembersSetChangeset

type WPSChannelMembersSetChangeset struct {
	Set []WPSChannelMembersSet `json:"set"`
}

WPSChannelMembersSetChangeset is the Objects API input to add, remove or update membership

type WPSChannelMembersUUID

type WPSChannelMembersUUID struct {
	ID string `json:"id"`
}

WPSChannelMembersUUID is the Objects API Members input struct used to add members

type WPSChannelMetadataInclude

type WPSChannelMetadataInclude int

WPSChannelMetadataInclude is used as an enum to catgorize the available Channel include types

const (
	// WPSChannelMetadataIncludeCustom is the enum equivalent to the value `custom` available Channel include types
	WPSChannelMetadataIncludeCustom WPSChannelMetadataInclude = 1 + iota
)

func (WPSChannelMetadataInclude) String

func (s WPSChannelMetadataInclude) String() string

type WPSDeleteFileResponse

type WPSDeleteFileResponse struct {
	// contains filtered or unexported fields
}

WPSDeleteFileResponse is the File Upload API Response for Delete file operation

type WPSDownloadFileResponse

type WPSDownloadFileResponse struct {
	File io.Reader `json:"data"`
	// contains filtered or unexported fields
}

WPSDownloadFileResponse is the File Upload API Response for Get Spaces

type WPSFCMData

type WPSFCMData struct {
	Data   WPSFCMDataFields `json:"data"`
	Custom map[string]interface{}
}

WPSFCMData is the struct used for the FCM paylod

type WPSFCMDataFields

type WPSFCMDataFields struct {
	Summary interface{} `json:"summary"`
	Custom  map[string]interface{}
}

WPSFCMDataFields is the helper struct used for the FCM paylod

type WPSFileData

type WPSFileData struct {
	ID string `json:"id"`
}

WPSFileData is used in the responses to show File ID

type WPSFileDetails

type WPSFileDetails struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	URL  string
}

WPSFileDetails is used in the responses to show File Info

type WPSFileInfo

type WPSFileInfo struct {
	Name    string `json:"name"`
	ID      string `json:"id"`
	Size    int    `json:"size"`
	Created string `json:"created"`
}

WPSFileInfo is the File Upload API struct returned on for each file.

type WPSFileInfoForPublish

type WPSFileInfoForPublish struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

WPSFileInfoForPublish is the part of the message struct used in Publish File

type WPSFileMessageAndDetails

type WPSFileMessageAndDetails struct {
	WPSMessage WPSPublishMessage `json:"message"`
	WPSFile    WPSFileDetails    `json:"file"`
}

WPSFileMessageAndDetails is used to store the file message and file info

type WPSFileUploadRequest

type WPSFileUploadRequest struct {
	URL        string         `json:"url"`
	Method     string         `json:"method"`
	FormFields []WPSFormField `json:"form_fields"`
}

WPSFileUploadRequest is used to store the info related to file upload to S3

type WPSFilesEvent

type WPSFilesEvent struct {
	File              WPSFileMessageAndDetails
	UserMetadata      interface{}
	SubscribedChannel string
	ActualChannel     string
	Channel           string
	Subscription      string
	Publisher         string
	Timetoken         int64
}

WPSFilesEvent is the Response for a Files Event

type WPSFormField

type WPSFormField struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

WPSFormField is part of the struct used in file upload to S3

type WPSGetAllChannelMetadataResponse

type WPSGetAllChannelMetadataResponse struct {
	Data       []WPSChannel `json:"data"`
	TotalCount int          `json:"totalCount"`
	Next       string       `json:"next"`
	Prev       string       `json:"prev"`
	// contains filtered or unexported fields
}

WPSGetAllChannelMetadataResponse is the Objects API Response for Get Spaces

type WPSGetAllUUIDMetadataResponse

type WPSGetAllUUIDMetadataResponse struct {
	Data       []WPSUUID `json:"data"`
	TotalCount int       `json:"totalCount"`
	Next       string    `json:"next"`
	Prev       string    `json:"prev"`
	// contains filtered or unexported fields
}

WPSGetAllUUIDMetadataResponse is the Objects API Response for Get Users

type WPSGetChannelMembersResponse

type WPSGetChannelMembersResponse struct {
	Data       []WPSChannelMembers `json:"data"`
	TotalCount int                 `json:"totalCount"`
	Next       string              `json:"next"`
	Prev       string              `json:"prev"`
	// contains filtered or unexported fields
}

WPSGetChannelMembersResponse is the Objects API Response for Get Members

type WPSGetChannelMetadataResponse

type WPSGetChannelMetadataResponse struct {
	Data WPSChannel `json:"data"`
	// contains filtered or unexported fields
}

WPSGetChannelMetadataResponse is the Objects API Response for Get Space

type WPSGetFileURLResponse

type WPSGetFileURLResponse struct {
	URL string `json:"location"`
}

WPSGetFileURLResponse is the File Upload API Response for Get Spaces

type WPSGetMembershipsResponse

type WPSGetMembershipsResponse struct {
	Data       []WPSMemberships `json:"data"`
	TotalCount int              `json:"totalCount"`
	Next       string           `json:"next"`
	Prev       string           `json:"prev"`
	// contains filtered or unexported fields
}

WPSGetMembershipsResponse is the Objects API Response for Get Memberships

type WPSGetMessageActionsMore

type WPSGetMessageActionsMore struct {
	URL   string `json:"url"`
	Start string `json:"start"`
	End   string `json:"end"`
	Limit int    `json:"limit"`
}

WPSGetMessageActionsMore is the struct used when the WPSGetMessageActionsResponse has more link

type WPSGetMessageActionsResponse

type WPSGetMessageActionsResponse struct {
	Data []WPSMessageActionsResponse `json:"data"`
	More WPSGetMessageActionsMore    `json:"more"`
	// contains filtered or unexported fields
}

WPSGetMessageActionsResponse is the GetMessageActions API Response

type WPSGetUUIDMetadataResponse

type WPSGetUUIDMetadataResponse struct {
	Data WPSUUID `json:"data"`
	// contains filtered or unexported fields
}

WPSGetUUIDMetadataResponse is the Objects API Response for Get User

type WPSGrantBitMask

type WPSGrantBitMask int64

WPSGrantBitMask is the type for perms BitMask

type WPSGrantTokenData

type WPSGrantTokenData struct {
	Message string `json:"message"`
	Token   string `json:"token"`
}

WPSGrantTokenData is the struct used to decode the server response

type WPSGrantTokenDecoded

type WPSGrantTokenDecoded 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"`
	AuthorizedUUID string                 `cbor:"uuid"`
}

WPSGrantTokenDecoded is the struct used to decode the server response

func GetPermissions

func GetPermissions(token string) (WPSGrantTokenDecoded, error)

GetPermissions decodes the CBORToken

type WPSGrantTokenResponse

type WPSGrantTokenResponse struct {
	Data WPSGrantTokenData `json:"data"`
	// contains filtered or unexported fields
}

WPSGrantTokenResponse is the struct returned when the Execute function of Grant Token is called.

type WPSGrantType

type WPSGrantType int

WPSGrantType grant types

const (
	// WPSReadEnabled Read Enabled. Applies to Subscribe, History, Presence, Objects
	WPSReadEnabled WPSGrantType = 1 + iota
	// WPSWriteEnabled Write Enabled. Applies to Publish, Objects
	WPSWriteEnabled
	// WPSManageEnabled Manage Enabled. Applies to Channel-Groups, Objects
	WPSManageEnabled
	// WPSDeleteEnabled Delete Enabled. Applies to History, Objects
	WPSDeleteEnabled
	// WPSCreateEnabled Create Enabled. Applies to Objects
	WPSCreateEnabled
	// WPSGetEnabled Get Enabled. Applies to Objects
	WPSGetEnabled
	// WPSUpdateEnabled Update Enabled. Applies to Objects
	WPSUpdateEnabled
	// WPSJoinEnabled Join Enabled. Applies to Objects
	WPSJoinEnabled
)

type WPSHistoryMessageActionTypeVal

type WPSHistoryMessageActionTypeVal struct {
	UUID            string `json:"uuid"`
	ActionTimetoken string `json:"actionTimetoken"`
}

WPSHistoryMessageActionTypeVal is the struct used in the Fetch request that includes Message Actions

type WPSHistoryMessageActionsTypeMap

type WPSHistoryMessageActionsTypeMap struct {
	ActionsTypeValues map[string][]WPSHistoryMessageActionTypeVal `json:"-"`
}

WPSHistoryMessageActionsTypeMap is the struct used in the Fetch request that includes Message Actions

type WPSListFilesResponse

type WPSListFilesResponse struct {
	Data  []WPSFileInfo `json:"data"`
	Count int           `json:"count"`
	Next  string        `json:"next"`
	// contains filtered or unexported fields
}

WPSListFilesResponse is the File Upload API Response for Get Spaces

type WPSMPNSData

type WPSMPNSData 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{}
}

WPSMPNSData is the struct used for the MPNS paylod

type WPSManageChannelMembersBody

type WPSManageChannelMembersBody struct {
	Set    []WPSChannelMembersSet    `json:"set"`
	Remove []WPSChannelMembersRemove `json:"delete"`
}

WPSManageChannelMembersBody is the Objects API input to add, remove or update members

type WPSManageMembersResponse

type WPSManageMembersResponse struct {
	Data       []WPSChannelMembers `json:"data"`
	TotalCount int                 `json:"totalCount"`
	Next       string              `json:"next"`
	Prev       string              `json:"prev"`
	// contains filtered or unexported fields
}

WPSManageMembersResponse is the Objects API Response for ManageMembers

type WPSManageMembershipsBody

type WPSManageMembershipsBody struct {
	Set    []WPSMembershipsSet    `json:"set"`
	Remove []WPSMembershipsRemove `json:"delete"`
}

WPSManageMembershipsBody is the Objects API input to add, remove or update membership

type WPSManageMembershipsResponse

type WPSManageMembershipsResponse struct {
	Data       []WPSMemberships `json:"data"`
	TotalCount int              `json:"totalCount"`
	Next       string           `json:"next"`
	Prev       string           `json:"prev"`
	// contains filtered or unexported fields
}

WPSManageMembershipsResponse is the Objects API Response for ManageMemberships

type WPSMembersAddChangeSet

type WPSMembersAddChangeSet struct {
	Set []WPSMembershipsSet `json:"set"`
}

WPSMembersAddChangeSet is the Objects API input to add, remove or update members

type WPSMembershipEvent

type WPSMembershipEvent struct {
	Event             WPSObjectsEvent
	UUID              string
	ChannelID         string
	Description       string
	Timestamp         string
	Custom            map[string]interface{}
	SubscribedChannel string
	ActualChannel     string
	Channel           string
	Subscription      string
}

WPSMembershipEvent is the Response for a Membership Event

type WPSMemberships

type WPSMemberships struct {
	ID      string                 `json:"id"`
	Channel WPSChannel             `json:"channel"`
	Created string                 `json:"created"`
	Updated string                 `json:"updated"`
	ETag    string                 `json:"eTag"`
	Custom  map[string]interface{} `json:"custom"`
}

WPSMemberships is the Objects API Memberships struct

type WPSMembershipsChannel

type WPSMembershipsChannel struct {
	ID string `json:"id"`
}

WPSMembershipsChannel is the Objects API Memberships input struct used to add members

type WPSMembershipsInclude

type WPSMembershipsInclude int

WPSMembershipsInclude is used as an enum to catgorize the available Memberships include types

const (
	// WPSMembershipsIncludeCustom is the enum equivalent to the value `custom` available Memberships include types
	WPSMembershipsIncludeCustom WPSMembershipsInclude = 1 + iota
	// WPSMembershipsIncludeChannel is the enum equivalent to the value `channel` available Memberships include types
	WPSMembershipsIncludeChannel
	// WPSMembershipsIncludeChannelCustom is the enum equivalent to the value `channel.custom` available Memberships include types
	WPSMembershipsIncludeChannelCustom
)

func (WPSMembershipsInclude) String

func (s WPSMembershipsInclude) String() string

type WPSMembershipsRemove

type WPSMembershipsRemove struct {
	Channel WPSMembershipsChannel `json:"channel"`
}

WPSMembershipsRemove is the Objects API Memberships struct used to remove members

type WPSMembershipsRemoveChangeSet

type WPSMembershipsRemoveChangeSet struct {
	Remove []WPSMembershipsRemove `json:"delete"`
}

WPSMembershipsRemoveChangeSet is the Objects API input to add, remove or update members

type WPSMembershipsSet

type WPSMembershipsSet struct {
	Channel WPSMembershipsChannel  `json:"channel"`
	Custom  map[string]interface{} `json:"custom"`
}

WPSMembershipsSet is the Objects API Memberships input struct used to add members

type WPSMessage

type WPSMessage struct {
	Message           interface{}
	UserMetadata      interface{}
	SubscribedChannel string
	ActualChannel     string
	Channel           string
	Subscription      string
	Publisher         string
	Timetoken         int64
}

WPSMessage is the Message Response for Subscribe

type WPSMessageActionsEvent

type WPSMessageActionsEvent struct {
	Event             WPSMessageActionsEventType
	Data              WPSMessageActionsResponse
	SubscribedChannel string
	ActualChannel     string
	Channel           string
	Subscription      string
}

WPSMessageActionsEvent is the Response for a Message Actions Event

type WPSMessageActionsEventType

type WPSMessageActionsEventType string

WPSMessageActionsEventType is used as an enum to catgorize the available Message Actions Event types

const (
	// WPSMessageActionsAdded is the enum when the event of type `added` occurs
	WPSMessageActionsAdded WPSMessageActionsEventType = "added"
	// WPSMessageActionsRemoved is the enum when the event of type `removed` occurs
	WPSMessageActionsRemoved = "removed"
)

type WPSMessageActionsResponse

type WPSMessageActionsResponse struct {
	ActionType       string `json:"type"`
	ActionValue      string `json:"value"`
	ActionTimetoken  string `json:"actionTimetoken"`
	MessageTimetoken string `json:"messageTimetoken"`
	UUID             string `json:"uuid"`
}

WPSMessageActionsResponse Message Actions response.

type WPSMessageType

type WPSMessageType int

WPSMessageType is used as an enum to catgorize the Subscribe response.

const (
	// WPSMessageTypeSignal is to identify Signal the Subscribe response
	WPSMessageTypeSignal WPSMessageType = 1 + iota
	// WPSMessageTypeObjects is to identify Objects the Subscribe response
	WPSMessageTypeObjects
	// WPSMessageTypeMessageActions is to identify Actions the Subscribe response
	WPSMessageTypeMessageActions
	// WPSMessageTypeFile is to identify Files the Subscribe response
	WPSMessageTypeFile
)

type WPSObjectsEvent

type WPSObjectsEvent string

WPSObjectsEvent is used as an enum to catgorize the available Object Events

const (
	// WPSObjectsEventRemove is the enum when the event `delete` occurs
	WPSObjectsEventRemove WPSObjectsEvent = "delete"
	// WPSObjectsEventSet is the enum when the event `set` occurs
	WPSObjectsEventSet = "set"
)

type WPSObjectsEventType

type WPSObjectsEventType string

WPSObjectsEventType is used as an enum to catgorize the available Object Event types

type WPSObjectsResponse

type WPSObjectsResponse struct {
	Event       WPSObjectsEvent        `json:"event"` // enum value
	EventType   WPSObjectsEventType    `json:"type"`  // enum value
	Name        string                 `json:"name"`
	ID          string                 `json:"id"`          // the uuid if user related
	Channel     string                 `json:"channel"`     // the channel 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"`
	Updated     string                 `json:"updated"`
	ETag        string                 `json:"eTag"`
	Custom      map[string]interface{} `json:"custom"`
	Data        map[string]interface{} `json:"data"`
}

WPSObjectsResponse is the Objects API collective Response struct of all methods.

type WPSPAMEntityData

type WPSPAMEntityData struct {
	Name          string
	AuthKeys      map[string]*WPSAccessManagerKeyData
	ReadEnabled   bool
	WriteEnabled  bool
	ManageEnabled bool
	DeleteEnabled bool
	GetEnabled    bool
	UpdateEnabled bool
	JoinEnabled   bool
	TTL           int
}

WPSPAMEntityData is the struct containing the access details of the channels.

type WPSPresence

type WPSPresence 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
}

WPSPresence is the Message Response for Presence

type WPSPublishFileMessage

type WPSPublishFileMessage struct {
	WPSMessage *WPSPublishMessage     `json:"message"`
	WPSFile    *WPSFileInfoForPublish `json:"file"`
}

WPSPublishFileMessage is the message struct used in Publish File

type WPSPublishMessage

type WPSPublishMessage struct {
	Text string `json:"text"`
}

WPSPublishMessage is the part of the message struct used in Publish File

type WPSPushEnvironment

type WPSPushEnvironment string

WPSPushEnvironment is used as an enum to catgorize the available Message Actions Event types

const (
	//WPSPushEnvironmentDevelopment for development
	WPSPushEnvironmentDevelopment WPSPushEnvironment = "development"
	//WPSPushEnvironmentProduction for production
	WPSPushEnvironmentProduction = "production"
)

type WPSPushTarget

type WPSPushTarget struct {
	Topic          string             `json:"topic"`
	ExcludeDevices []string           `json:"exclude_devices"`
	Environment    WPSPushEnvironment `json:"environment"`
}

WPSPushTarget is the helper struct used for the APNS2 paylod

type WPSPushType

type WPSPushType int

WPSPushType is used as an enum to catgorize the available Push Types

const (
	// WPSPushTypeNone is used as an enum to for selecting `none` as the WPSPushType
	WPSPushTypeNone WPSPushType = 1 + iota
	// WPSPushTypeGCM is used as an enum to for selecting `GCM` as the WPSPushType
	WPSPushTypeGCM
	// WPSPushTypeAPNS is used as an enum to for selecting `APNS` as the WPSPushType
	WPSPushTypeAPNS
	// WPSPushTypeMPNS is used as an enum to for selecting `MPNS` as the WPSPushType
	WPSPushTypeMPNS
	// WPSPushTypeAPNS2 is used as an enum to for selecting `APNS2` as the WPSPushType
	WPSPushTypeAPNS2
)

func (WPSPushType) String

func (p WPSPushType) String() string

type WPSRemoveChannelMembersResponse

type WPSRemoveChannelMembersResponse struct {
	Data       []WPSChannelMembers `json:"data"`
	TotalCount int                 `json:"totalCount"`
	Next       string              `json:"next"`
	Prev       string              `json:"prev"`
	// contains filtered or unexported fields
}

WPSRemoveChannelMembersResponse is the Objects API Response for RemoveChannelMembers

type WPSRemoveChannelMetadataResponse

type WPSRemoveChannelMetadataResponse struct {
	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

WPSRemoveChannelMetadataResponse is the Objects API Response for delete space

type WPSRemoveMembershipsResponse

type WPSRemoveMembershipsResponse struct {
	Data       []WPSMemberships `json:"data"`
	TotalCount int              `json:"totalCount"`
	Next       string           `json:"next"`
	Prev       string           `json:"prev"`
	// contains filtered or unexported fields
}

WPSRemoveMembershipsResponse is the Objects API Response for RemoveMemberships

type WPSRemoveMessageActionsResponse

type WPSRemoveMessageActionsResponse struct {
	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

WPSRemoveMessageActionsResponse is the Objects API Response for create space

type WPSRemoveUUIDMetadataResponse

type WPSRemoveUUIDMetadataResponse struct {
	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

WPSRemoveUUIDMetadataResponse is the Objects API Response for delete user

type WPSResourceType

type WPSResourceType int

WPSResourceType grant types

const (
	// WPSChannels for channels
	WPSChannels WPSResourceType = 1 + iota
	// WPSGroups for groups
	WPSGroups
	// WPSUsers for users
	WPSUUIDs
)

type WPSRevokeTokenResponse

type WPSRevokeTokenResponse struct {
	// contains filtered or unexported fields
}

WPSRevokeTokenResponse is the struct returned when the Execute function of Grant Token is called.

type WPSSendFileBody

type WPSSendFileBody struct {
	Name string `json:"name"`
}

WPSSendFileBody is used to create the body of the request

type WPSSendFileResponse

type WPSSendFileResponse struct {
	Timestamp int64

	Data WPSFileData `json:"data"`
	// contains filtered or unexported fields
}

WPSSendFileResponse is the type used to store the response info of Send File.

type WPSSendFileResponseForS3

type WPSSendFileResponseForS3 struct {
	Data              WPSFileData          `json:"data"`
	FileUploadRequest WPSFileUploadRequest `json:"file_upload_request"`
	// contains filtered or unexported fields
}

WPSSendFileResponseForS3 is the File Upload API Response for SendFile.

type WPSSendFileToS3Response

type WPSSendFileToS3Response struct {
}

WPSSendFileToS3Response is the File Upload API Response for Get Spaces

type WPSSetChannelMembersResponse

type WPSSetChannelMembersResponse struct {
	Data       []WPSChannelMembers `json:"data"`
	TotalCount int                 `json:"totalCount"`
	Next       string              `json:"next"`
	Prev       string              `json:"prev"`
	// contains filtered or unexported fields
}

WPSSetChannelMembersResponse is the Objects API Response for SetChannelMembers

type WPSSetChannelMetadataResponse

type WPSSetChannelMetadataResponse struct {
	Data WPSChannel `json:"data"`
	// contains filtered or unexported fields
}

WPSSetChannelMetadataResponse is the Objects API Response for Update Space

type WPSSetMembershipsResponse

type WPSSetMembershipsResponse struct {
	Data       []WPSMemberships `json:"data"`
	TotalCount int              `json:"totalCount"`
	Next       string           `json:"next"`
	Prev       string           `json:"prev"`
	// contains filtered or unexported fields
}

WPSSetMembershipsResponse is the Objects API Response for SetMemberships

type WPSSetUUIDMetadataResponse

type WPSSetUUIDMetadataResponse struct {
	Data WPSUUID `json:"data"`
	// contains filtered or unexported fields
}

WPSSetUUIDMetadataResponse is the Objects API Response for Update user

type WPSStatus

type WPSStatus 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
}

WPSStatus is the status struct

type WPSToken

type WPSToken struct {
	Version        int
	Timestamp      int64
	TTL            int
	AuthorizedUUID string
	Resources      WPSTokenResources
	Patterns       WPSTokenResources
	Meta           map[string]interface{}
}

func ParseToken

func ParseToken(token string) (*WPSToken, error)

type WPSTokenResources

type WPSTokenResources struct {
	Channels      map[string]ChannelPermissions
	ChannelGroups map[string]GroupPermissions
	UUIDs         map[string]UUIDPermissions
}

type WPSUUID

type WPSUUID struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	ExternalID string                 `json:"externalId"`
	ProfileURL string                 `json:"profileUrl"`
	Email      string                 `json:"email"`
	Updated    string                 `json:"updated"`
	ETag       string                 `json:"eTag"`
	Custom     map[string]interface{} `json:"custom"`
}

WPSUUID is the Objects API user struct

type WPSUUIDEvent

type WPSUUIDEvent struct {
	Event             WPSObjectsEvent
	UUID              string
	Description       string
	Timestamp         string
	Name              string
	ExternalID        string
	ProfileURL        string
	Email             string
	Updated           string
	ETag              string
	Custom            map[string]interface{}
	SubscribedChannel string
	ActualChannel     string
	Channel           string
	Subscription      string
}

WPSUUIDEvent is the Response for an User Event

type WPSUUIDMetadataInclude

type WPSUUIDMetadataInclude int

WPSUUIDMetadataInclude is used as an enum to catgorize the available UUID include types

const (
	// WPSUUIDMetadataIncludeCustom is the enum equivalent to the value `custom` available UUID include types
	WPSUUIDMetadataIncludeCustom WPSUUIDMetadataInclude = 1 + iota
)

func (WPSUUIDMetadataInclude) String

func (s WPSUUIDMetadataInclude) String() string

type WebPubSub

type WebPubSub struct {
	sync.RWMutex

	Config *Config
	// contains filtered or unexported fields
}

WebPubSub No server connection will be established when you create a new WebPubSub object. To establish a new connection use Subscribe() function of WebPubSub type.

func NewWebPubSub

func NewWebPubSub(pnconf *Config) *WebPubSub

NewWebPubSub instantiates a WebPubSub instance with default values.

func NewWebPubSubDemo

func NewWebPubSubDemo() *WebPubSub

NewWebPubSubDemo returns an instance with demo keys

func (*WebPubSub) AddChannelToChannelGroup

func (pn *WebPubSub) AddChannelToChannelGroup() *addChannelToChannelGroupBuilder

AddChannelToChannelGroup This function adds a channel to a channel group.

func (*WebPubSub) AddChannelToChannelGroupWithContext

func (pn *WebPubSub) AddChannelToChannelGroupWithContext(ctx Context) *addChannelToChannelGroupBuilder

AddChannelToChannelGroupWithContext This function adds a channel to a channel group.

func (*WebPubSub) AddListener

func (pn *WebPubSub) AddListener(listener *Listener)

AddListener lets you add a new listener.

func (*WebPubSub) AddMessageAction

func (pn *WebPubSub) AddMessageAction() *addMessageActionsBuilder

AddMessageAction Add an action on a published message. Returns the added action in the response.

func (*WebPubSub) AddMessageActionWithContext

func (pn *WebPubSub) AddMessageActionWithContext(ctx Context) *addMessageActionsBuilder

AddMessageActionWithContext Add an action on a published message. Returns the added action in the response.

func (*WebPubSub) AddPushNotificationsOnChannels

func (pn *WebPubSub) AddPushNotificationsOnChannels() *addPushNotificationsOnChannelsBuilder

AddPushNotificationsOnChannels Enable push notifications on provided set of channels.

func (*WebPubSub) AddPushNotificationsOnChannelsWithContext

func (pn *WebPubSub) AddPushNotificationsOnChannelsWithContext(ctx Context) *addPushNotificationsOnChannelsBuilder

AddPushNotificationsOnChannelsWithContext Enable push notifications on provided set of channels.

func (*WebPubSub) CreatePushPayload

func (pn *WebPubSub) CreatePushPayload() *publishPushHelperBuilder

CreatePushPayload This method creates the push payload for use in the appropriate endpoint calls.

func (*WebPubSub) CreatePushPayloadWithContext

func (pn *WebPubSub) CreatePushPayloadWithContext(ctx Context) *publishPushHelperBuilder

CreatePushPayloadWithContext This method creates the push payload for use in the appropriate endpoint calls.

func (*WebPubSub) DeleteChannelGroup

func (pn *WebPubSub) DeleteChannelGroup() *deleteChannelGroupBuilder

DeleteChannelGroup This function removes the channel group.

func (*WebPubSub) DeleteChannelGroupWithContext

func (pn *WebPubSub) DeleteChannelGroupWithContext(ctx Context) *deleteChannelGroupBuilder

DeleteChannelGroupWithContext This function removes the channel group.

func (*WebPubSub) DeleteFile

func (pn *WebPubSub) DeleteFile() *deleteFileBuilder

DeleteFile Provides the ability to delete an individual file.

func (*WebPubSub) DeleteFileWithContext

func (pn *WebPubSub) DeleteFileWithContext(ctx Context) *deleteFileBuilder

DeleteFileWithContext Provides the ability to delete an individual file

func (*WebPubSub) DeleteMessages

func (pn *WebPubSub) DeleteMessages() *historyDeleteBuilder

DeleteMessages Removes the messages from the history of a specific channel.

func (*WebPubSub) DeleteMessagesWithContext

func (pn *WebPubSub) DeleteMessagesWithContext(ctx Context) *historyDeleteBuilder

DeleteMessagesWithContext Removes the messages from the history of a specific channel.

func (*WebPubSub) Destroy

func (pn *WebPubSub) Destroy()

Destroy stops all open requests, removes listeners, closes heartbeats, and cleans up.

func (*WebPubSub) DownloadFile

func (pn *WebPubSub) DownloadFile() *downloadFileBuilder

DownloadFile Provides the ability to fetch an individual file.

func (*WebPubSub) DownloadFileWithContext

func (pn *WebPubSub) DownloadFileWithContext(ctx Context) *downloadFileBuilder

DownloadFileWithContext Provides the ability to fetch an individual file.

func (*WebPubSub) Fetch

func (pn *WebPubSub) Fetch() *fetchBuilder

Fetch fetches historical messages from multiple channels.

func (*WebPubSub) FetchWithContext

func (pn *WebPubSub) FetchWithContext(ctx Context) *fetchBuilder

FetchWithContext fetches historical messages from multiple channels.

func (*WebPubSub) Fire

func (pn *WebPubSub) Fire() *fireBuilder

Fire endpoint allows the client to send a message to WebPubSub Functions Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution.

func (*WebPubSub) FireWithContext

func (pn *WebPubSub) FireWithContext(ctx Context) *fireBuilder

FireWithContext endpoint allows the client to send a message to WebPubSub Functions Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution.

func (*WebPubSub) GetAllChannelMetadata

func (pn *WebPubSub) GetAllChannelMetadata() *getAllChannelMetadataBuilder

GetAllChannelMetadata Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.

func (*WebPubSub) GetAllChannelMetadataWithContext

func (pn *WebPubSub) GetAllChannelMetadataWithContext(ctx Context) *getAllChannelMetadataBuilder

GetAllChannelMetadataWithContext Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.

func (*WebPubSub) GetAllUUIDMetadata

func (pn *WebPubSub) GetAllUUIDMetadata() *getAllUUIDMetadataBuilder

GetAllUUIDMetadata Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.

func (*WebPubSub) GetAllUUIDMetadataWithContext

func (pn *WebPubSub) GetAllUUIDMetadataWithContext(ctx Context) *getAllUUIDMetadataBuilder

GetAllUUIDMetadataWithContext Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.

func (*WebPubSub) GetChannelMembers

func (pn *WebPubSub) GetChannelMembers() *getChannelMembersBuilderV2

GetChannelMembers The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.

func (*WebPubSub) GetChannelMembersWithContext

func (pn *WebPubSub) GetChannelMembersWithContext(ctx Context) *getChannelMembersBuilderV2

GetChannelMembersWithContext The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.

func (*WebPubSub) GetChannelMetadata

func (pn *WebPubSub) GetChannelMetadata() *getChannelMetadataBuilder

GetChannelMetadata Returns metadata for the specified Channel, optionally including the custom data object for each.

func (*WebPubSub) GetChannelMetadataWithContext

func (pn *WebPubSub) GetChannelMetadataWithContext(ctx Context) *getChannelMetadataBuilder

GetChannelMetadataWithContext Returns metadata for the specified Channel, optionally including the custom data object for each.

func (*WebPubSub) GetClient

func (pn *WebPubSub) GetClient() *http.Client

GetClient Get a client for transactional requests (Non Subscribe).

func (*WebPubSub) GetFileURL

func (pn *WebPubSub) GetFileURL() *getFileURLBuilder

GetFileURL gets the URL of the file.

func (*WebPubSub) GetFileURLWithContext

func (pn *WebPubSub) GetFileURLWithContext(ctx Context) *getFileURLBuilder

GetFileURLWithContext gets the URL of the file.

func (*WebPubSub) GetListeners

func (pn *WebPubSub) GetListeners() map[*Listener]bool

GetListeners gets all the existing isteners.

func (*WebPubSub) GetMemberships

func (pn *WebPubSub) GetMemberships() *getMembershipsBuilderV2

GetMemberships The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

func (*WebPubSub) GetMembershipsWithContext

func (pn *WebPubSub) GetMembershipsWithContext(ctx Context) *getMembershipsBuilderV2

GetMembershipsWithContext The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

func (*WebPubSub) GetMessageActions

func (pn *WebPubSub) GetMessageActions() *getMessageActionsBuilder

GetMessageActions Get a list of message actions in a channel. Returns a list of actions in the response.

func (*WebPubSub) GetMessageActionsWithContext

func (pn *WebPubSub) GetMessageActionsWithContext(ctx Context) *getMessageActionsBuilder

GetMessageActionsWithContext Get a list of message actions in a channel. Returns a list of actions in the response.

func (*WebPubSub) GetState

func (pn *WebPubSub) GetState() *getStateBuilder

GetState The state API is used to set/get key/value pairs specific to a subscriber UUID. State information is supplied as a JSON object of key/value pairs.

func (*WebPubSub) GetStateWithContext

func (pn *WebPubSub) GetStateWithContext(ctx Context) *getStateBuilder

GetStateWithContext The state API is used to set/get key/value pairs specific to a subscriber UUID. State information is supplied as a JSON object of key/value pairs.

func (*WebPubSub) GetSubscribeClient

func (pn *WebPubSub) GetSubscribeClient() *http.Client

GetSubscribeClient Get a client for transactional requests.

func (*WebPubSub) GetSubscribedChannels

func (pn *WebPubSub) GetSubscribedChannels() []string

GetSubscribedChannels gets a list of all subscribed channels.

func (*WebPubSub) GetSubscribedGroups

func (pn *WebPubSub) GetSubscribedGroups() []string

GetSubscribedGroups gets a list of all subscribed channel groups.

func (*WebPubSub) GetUUIDMetadata

func (pn *WebPubSub) GetUUIDMetadata() *getUUIDMetadataBuilder

GetUUIDMetadata Returns metadata for the specified UUID, optionally including the custom data object for each.

func (*WebPubSub) GetUUIDMetadataWithContext

func (pn *WebPubSub) GetUUIDMetadataWithContext(ctx Context) *getUUIDMetadataBuilder

GetUUIDMetadataWithContext Returns metadata for the specified UUID, optionally including the custom data object for each.

func (*WebPubSub) Grant

func (pn *WebPubSub) Grant() *grantBuilder

Grant This function establishes access permissions for WebPubSub Access Manager (PAM) by setting the read or write attribute to true. A grant with read or write set to false (or not included) will revoke any previous grants with read or write set to true.

func (*WebPubSub) GrantToken

func (pn *WebPubSub) GrantToken() *grantTokenBuilder

GrantToken Use the Grant Token method to generate an auth token with embedded access control lists. The client sends the auth token to WebPubSub along with each request.

func (*WebPubSub) GrantTokenWithContext

func (pn *WebPubSub) GrantTokenWithContext(ctx Context) *grantTokenBuilder

GrantTokenWithContext Use the Grant Token method to generate an auth token with embedded access control lists. The client sends the auth token to WebPubSub along with each request.

func (*WebPubSub) GrantWithContext

func (pn *WebPubSub) GrantWithContext(ctx Context) *grantBuilder

GrantWithContext This function establishes access permissions for WebPubSub Access Manager (PAM) by setting the read or write attribute to true. A grant with read or write set to false (or not included) will revoke any previous grants with read or write set to true.

func (*WebPubSub) Heartbeat

func (pn *WebPubSub) Heartbeat() *heartbeatBuilder

Heartbeat You can send presence heartbeat notifications without subscribing to a channel. These notifications are sent periodically and indicate whether a client is connected or not.

func (*WebPubSub) HeartbeatWithContext

func (pn *WebPubSub) HeartbeatWithContext(ctx Context) *heartbeatBuilder

HeartbeatWithContext You can send presence heartbeat notifications without subscribing to a channel. These notifications are sent periodically and indicate whether a client is connected or not.

func (*WebPubSub) HereNow

func (pn *WebPubSub) HereNow() *hereNowBuilder

HereNow You can obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total occupancy count of the channel by calling the HereNow() function in your application.

func (*WebPubSub) HereNowWithContext

func (pn *WebPubSub) HereNowWithContext(ctx Context) *hereNowBuilder

HereNowWithContext You can obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total occupancy count of the channel by calling the HereNow() function in your application.

func (*WebPubSub) History

func (pn *WebPubSub) History() *historyBuilder

History fetches historical messages of a channel.

func (*WebPubSub) HistoryWithContext

func (pn *WebPubSub) HistoryWithContext(ctx Context) *historyBuilder

HistoryWithContext fetches historical messages of a channel.

func (*WebPubSub) Leave

func (pn *WebPubSub) Leave() *leaveBuilder

Leave unsubscribes from a channel.

func (*WebPubSub) LeaveWithContext

func (pn *WebPubSub) LeaveWithContext(ctx Context) *leaveBuilder

LeaveWithContext unsubscribes from a channel.

func (*WebPubSub) ListChannelsInChannelGroup

func (pn *WebPubSub) ListChannelsInChannelGroup() *allChannelGroupBuilder

ListChannelsInChannelGroup This function lists all the channels of the channel group.

func (*WebPubSub) ListChannelsInChannelGroupWithContext

func (pn *WebPubSub) ListChannelsInChannelGroupWithContext(ctx Context) *allChannelGroupBuilder

ListChannelsInChannelGroupWithContext This function lists all the channels of the channel group.

func (*WebPubSub) ListFiles

func (pn *WebPubSub) ListFiles() *listFilesBuilder

ListFiles Provides the ability to fetch all files in a channel.

func (*WebPubSub) ListFilesWithContext

func (pn *WebPubSub) ListFilesWithContext(ctx Context) *listFilesBuilder

ListFilesWithContext Provides the ability to fetch all files in a channel.

func (*WebPubSub) ListPushProvisions

func (pn *WebPubSub) ListPushProvisions() *listPushProvisionsRequestBuilder

ListPushProvisions Request for all channels on which push notification has been enabled using specified pushToken.

func (*WebPubSub) ListPushProvisionsWithContext

func (pn *WebPubSub) ListPushProvisionsWithContext(ctx Context) *listPushProvisionsRequestBuilder

ListPushProvisionsWithContext Request for all channels on which push notification has been enabled using specified pushToken.

func (*WebPubSub) ManageChannelMembers

func (pn *WebPubSub) ManageChannelMembers() *manageChannelMembersBuilderV2

ManageChannelMembers The method Set and Remove channel memberships for a user.

func (*WebPubSub) ManageChannelMembersWithContext

func (pn *WebPubSub) ManageChannelMembersWithContext(ctx Context) *manageChannelMembersBuilderV2

ManageChannelMembersWithContext The method Set and Remove channel memberships for a user.

func (*WebPubSub) ManageMemberships

func (pn *WebPubSub) ManageMemberships() *manageMembershipsBuilderV2

ManageMemberships Manage the specified UUID's memberships. You can Add, Remove, and Update a UUID's memberships.

func (*WebPubSub) ManageMembershipsWithContext

func (pn *WebPubSub) ManageMembershipsWithContext(ctx Context) *manageMembershipsBuilderV2

ManageMembershipsWithContext Manage the specified UUID's memberships. You can Add, Remove, and Update a UUID's memberships.

func (*WebPubSub) MessageCounts

func (pn *WebPubSub) MessageCounts() *messageCountsBuilder

MessageCounts Returns the number of messages published on one or more channels since a given time.

func (*WebPubSub) MessageCountsWithContext

func (pn *WebPubSub) MessageCountsWithContext(ctx Context) *messageCountsBuilder

MessageCountsWithContext Returns the number of messages published on one or more channels since a given time.

func (*WebPubSub) Presence

func (pn *WebPubSub) Presence() *presenceBuilder

Presence lets you subscribe to a presence channel.

func (*WebPubSub) PresenceWithContext

func (pn *WebPubSub) PresenceWithContext(ctx Context) *presenceBuilder

PresenceWithContext lets you subscribe to a presence channel.

func (*WebPubSub) Publish

func (pn *WebPubSub) Publish() *publishBuilder

Publish is used to send a message to all subscribers of a channel.

func (*WebPubSub) PublishFileMessage

func (pn *WebPubSub) PublishFileMessage() *publishFileMessageBuilder

PublishFileMessage Provides the ability to publish the asccociated messages with the uploaded file in case of failure to auto publish. To be used only in the case of failure.

func (*WebPubSub) PublishFileMessageWithContext

func (pn *WebPubSub) PublishFileMessageWithContext(ctx Context) *publishFileMessageBuilder

PublishFileMessageWithContext Provides the ability to publish the asccociated messages with the uploaded file in case of failure to auto publish. To be used only in the case of failure.

func (*WebPubSub) PublishWithContext

func (pn *WebPubSub) PublishWithContext(ctx Context) *publishBuilder

PublishWithContext function is used to send a message to all subscribers of a channel.

func (*WebPubSub) RemoveAllPushNotifications

func (pn *WebPubSub) RemoveAllPushNotifications() *removeAllPushChannelsForDeviceBuilder

RemoveAllPushNotifications Disable push notifications from all channels registered with the specified pushToken.

func (*WebPubSub) RemoveAllPushNotificationsWithContext

func (pn *WebPubSub) RemoveAllPushNotificationsWithContext(ctx Context) *removeAllPushChannelsForDeviceBuilder

RemoveAllPushNotificationsWithContext Disable push notifications from all channels registered with the specified pushToken.

func (*WebPubSub) RemoveChannelFromChannelGroup

func (pn *WebPubSub) RemoveChannelFromChannelGroup() *removeChannelFromChannelGroupBuilder

RemoveChannelFromChannelGroup This function removes the channels from the channel group.

func (*WebPubSub) RemoveChannelFromChannelGroupWithContext

func (pn *WebPubSub) RemoveChannelFromChannelGroupWithContext(ctx Context) *removeChannelFromChannelGroupBuilder

RemoveChannelFromChannelGroupWithContext This function removes the channels from the channel group.

func (*WebPubSub) RemoveChannelMembers

func (pn *WebPubSub) RemoveChannelMembers() *removeChannelMembersBuilder

RemoveChannelMembers Remove members from a Channel.

func (*WebPubSub) RemoveChannelMembersWithContext

func (pn *WebPubSub) RemoveChannelMembersWithContext(ctx Context) *removeChannelMembersBuilder

RemoveChannelMembersWithContext Remove members from a Channel.

func (*WebPubSub) RemoveChannelMetadata

func (pn *WebPubSub) RemoveChannelMetadata() *removeChannelMetadataBuilder

RemoveChannelMetadata Removes the metadata from a specified channel.

func (*WebPubSub) RemoveChannelMetadataWithContext

func (pn *WebPubSub) RemoveChannelMetadataWithContext(ctx Context) *removeChannelMetadataBuilder

RemoveChannelMetadataWithContext Removes the metadata from a specified channel.

func (*WebPubSub) RemoveListener

func (pn *WebPubSub) RemoveListener(listener *Listener)

RemoveListener lets you remove new listener.

func (*WebPubSub) RemoveMemberships

func (pn *WebPubSub) RemoveMemberships() *removeMembershipsBuilder

RemoveMemberships Remove channel memberships for a UUID.

func (*WebPubSub) RemoveMembershipsWithContext

func (pn *WebPubSub) RemoveMembershipsWithContext(ctx Context) *removeMembershipsBuilder

RemoveMembershipsWithContext Remove channel memberships for a UUID.

func (*WebPubSub) RemoveMessageAction

func (pn *WebPubSub) RemoveMessageAction() *removeMessageActionsBuilder

RemoveMessageAction Remove a peviously added action on a published message. Returns an empty response.

func (*WebPubSub) RemoveMessageActionWithContext

func (pn *WebPubSub) RemoveMessageActionWithContext(ctx Context) *removeMessageActionsBuilder

RemoveMessageActionWithContext Remove a peviously added action on a published message. Returns an empty response.

func (*WebPubSub) RemovePushNotificationsFromChannels

func (pn *WebPubSub) RemovePushNotificationsFromChannels() *removeChannelsFromPushBuilder

RemovePushNotificationsFromChannels Disable push notifications on provided set of channels.

func (*WebPubSub) RemovePushNotificationsFromChannelsWithContext

func (pn *WebPubSub) RemovePushNotificationsFromChannelsWithContext(ctx Context) *removeChannelsFromPushBuilder

RemovePushNotificationsFromChannelsWithContext Disable push notifications on provided set of channels.

func (*WebPubSub) RemoveUUIDMetadata

func (pn *WebPubSub) RemoveUUIDMetadata() *removeUUIDMetadataBuilder

RemoveUUIDMetadata Removes the metadata from a specified UUID.

func (*WebPubSub) RemoveUUIDMetadataWithContext

func (pn *WebPubSub) RemoveUUIDMetadataWithContext(ctx Context) *removeUUIDMetadataBuilder

RemoveUUIDMetadataWithContext Removes the metadata from a specified UUID.

func (*WebPubSub) ResetTokenManager

func (pn *WebPubSub) ResetTokenManager()

ResetTokenManager resets the token manager.

func (*WebPubSub) RevokeToken

func (pn *WebPubSub) RevokeToken() *revokeTokenBuilder

RevokeToken Use the Grant Token method to generate an auth token with embedded access control lists. The client sends the auth token to WebPubSub along with each request.

func (*WebPubSub) RevokeTokenWithContext

func (pn *WebPubSub) RevokeTokenWithContext(ctx Context) *revokeTokenBuilder

RevokeTokenWithContext Use the Grant Token method to generate an auth token with embedded access control lists. The client sends the auth token to WebPubSub along with each request.

func (*WebPubSub) SendFile

func (pn *WebPubSub) SendFile() *sendFileBuilder

SendFile Clients can use this SDK method to upload a file and publish it to other users in a channel.

func (*WebPubSub) SendFileWithContext

func (pn *WebPubSub) SendFileWithContext(ctx Context) *sendFileBuilder

SendFileWithContext Clients can use this SDK method to upload a file and publish it to other users in a channel.

func (*WebPubSub) SetChannelMembers

func (pn *WebPubSub) SetChannelMembers() *setChannelMembersBuilder

SetChannelMembers This method sets members in a channel.

func (*WebPubSub) SetChannelMembersWithContext

func (pn *WebPubSub) SetChannelMembersWithContext(ctx Context) *setChannelMembersBuilder

SetChannelMembersWithContext This method sets members in a channel.

func (*WebPubSub) SetChannelMetadata

func (pn *WebPubSub) SetChannelMetadata() *setChannelMetadataBuilder

SetChannelMetadata Set metadata for a Channel in the database, optionally including the custom data object for each.

func (*WebPubSub) SetChannelMetadataWithContext

func (pn *WebPubSub) SetChannelMetadataWithContext(ctx Context) *setChannelMetadataBuilder

SetChannelMetadataWithContext Set metadata for a Channel in the database, optionally including the custom data object for each.

func (*WebPubSub) SetClient

func (pn *WebPubSub) SetClient(c *http.Client)

SetClient Set a client for transactional requests (Non Subscribe).

func (*WebPubSub) SetMemberships

func (pn *WebPubSub) SetMemberships() *setMembershipsBuilder

SetMemberships Set channel memberships for a UUID.

func (*WebPubSub) SetMembershipsWithContext

func (pn *WebPubSub) SetMembershipsWithContext(ctx Context) *setMembershipsBuilder

SetMembershipsWithContext Set channel memberships for a UUID.

func (*WebPubSub) SetState

func (pn *WebPubSub) SetState() *setStateBuilder

SetState The state API is used to set/get key/value pairs specific to a subscriber UUID. State information is supplied as a JSON object of key/value pairs.

func (*WebPubSub) SetStateWithContext

func (pn *WebPubSub) SetStateWithContext(ctx Context) *setStateBuilder

SetStateWithContext The state API is used to set/get key/value pairs specific to a subscriber UUID. State information is supplied as a JSON object of key/value pairs.

func (*WebPubSub) SetSubscribeClient

func (pn *WebPubSub) SetSubscribeClient(client *http.Client)

SetSubscribeClient Set a client for transactional requests.

func (*WebPubSub) SetToken

func (pn *WebPubSub) SetToken(token string)

SetToken Stores a single token in the Token Management System for use in API calls.

func (*WebPubSub) SetUUIDMetadata

func (pn *WebPubSub) SetUUIDMetadata() *setUUIDMetadataBuilder

SetUUIDMetadata Set metadata for a UUID in the database, optionally including the custom data object for each.

func (*WebPubSub) SetUUIDMetadataWithContext

func (pn *WebPubSub) SetUUIDMetadataWithContext(ctx Context) *setUUIDMetadataBuilder

SetUUIDMetadataWithContext Set metadata for a UUID in the database, optionally including the custom data object for each.

func (*WebPubSub) Signal

func (pn *WebPubSub) Signal() *signalBuilder

Signal The signal() function is used to send a signal to all subscribers of a channel.

func (*WebPubSub) SignalWithContext

func (pn *WebPubSub) SignalWithContext(ctx Context) *signalBuilder

SignalWithContext The signal() function is used to send a signal to all subscribers of a channel.

func (*WebPubSub) Subscribe

func (pn *WebPubSub) Subscribe() *subscribeBuilder

Subscribe causes the client to create an open TCP socket to the WebPubSub Real-Time Network and begin listening for messages on a specified channel.

func (*WebPubSub) Time

func (pn *WebPubSub) Time() *timeBuilder

Time This function will return a 17 digit precision Unix epoch.

func (*WebPubSub) TimeWithContext

func (pn *WebPubSub) TimeWithContext(ctx Context) *timeBuilder

TimeWithContext This function will return a 17 digit precision Unix epoch.

func (*WebPubSub) Unsubscribe

func (pn *WebPubSub) Unsubscribe() *unsubscribeBuilder

Unsubscribe When subscribed to a single channel, this function causes the client to issue a leave from the channel and close any open socket to the WebPubSub Network. For multiplexed channels, the specified channel(s) will be removed and the socket remains open until there are no more channels remaining in the list.

func (*WebPubSub) UnsubscribeAll

func (pn *WebPubSub) UnsubscribeAll()

UnsubscribeAll Unsubscribe from all channels and all channel groups.

func (*WebPubSub) WhereNow

func (pn *WebPubSub) WhereNow() *whereNowBuilder

WhereNow You can obtain information about the current list of channels to which a UUID is subscribed to by calling the WhereNow() function in your application.

func (*WebPubSub) WhereNowWithContext

func (pn *WebPubSub) WhereNowWithContext(ctx Context) *whereNowBuilder

WhereNowWithContext You can obtain information about the current list of channels to which a UUID is subscribed to by calling the WhereNow() function in your application.

type WhereNowResponse

type WhereNowResponse struct {
	Channels []string
}

WhereNowResponse is the response of the WhereNow request. Contains channels info.

type Worker

type Worker struct {
	WorkersChannel chan chan *JobQItem
	JobChannel     chan *JobQItem
	// contains filtered or unexported fields
}

Worker is the type to store the worker info

func (Worker) Process

func (pw Worker) Process(webpubsub *WebPubSub)

Process runs a goroutine for the worker

Source Files

Directories

Path Synopsis
examples
cli
tests
e2e

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL