Documentation
¶
Index ¶
- func WithAPIKey(apikey string) func(*API)
- func WithEventBufferSize(eventBufferSize int) func(*Sub)
- func WithHTTPClient(httpclient *http.Client) func(*API)
- func WithJWTKey(jwtKey string) func(*Sub)
- func WithMaxBufferSize(maxBufferSize int) func(*Sub)
- func WithReconnectStrategy(reconnectStrategy backoff.BackOff) func(*Sub)
- type API
- type APIMethod
- type APIRequest
- type BoolValue
- type ErrBadStatus
- type ErrLogic
- type EventData
- type GetOnlineParams
- type GetOnlineResponse
- type PresenceItem
- type PublishParams
- type PublishResponse
- type Sub
- type SubscribeOptionOverride
- type SubscribeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAPIKey ¶
func WithEventBufferSize ¶
func WithHTTPClient ¶
func WithJWTKey ¶
func WithMaxBufferSize ¶
func WithReconnectStrategy ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) GetOnlines ¶
func (p *API) GetOnlines(ctx context.Context, params *GetOnlineParams) (map[string]PresenceItem, error)
GetOnlines allows getting channel online presence information (all clients currently subscribed on this channel)
type APIRequest ¶
type APIRequest struct {
Method string `json:"method"`
Params interface{} `json:"params"`
}
type ErrBadStatus ¶
func (*ErrBadStatus) Error ¶
func (err *ErrBadStatus) Error() string
type EventData ¶
type EventData struct {
Channel string `json:"channel,omitempty"`
Pub struct {
Data json.RawMessage `json:"data,omitempty"`
} `json:"pub,omitempty"`
}
type GetOnlineParams ¶
type GetOnlineParams struct {
Channel string `json:"channel,omitempty"`
}
type GetOnlineResponse ¶
type GetOnlineResponse struct {
Error ErrLogic `json:"error,omitempty"`
Result struct {
Presence map[string]PresenceItem `json:"presence,omitempty"`
} `json:"result,omitempty"`
}
type PresenceItem ¶
type PublishParams ¶
type PublishParams struct {
Channel string `json:"channel,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
SkipHistory bool `json:"skip_history,omitempty"`
}
type PublishResponse ¶
type Sub ¶
type Sub struct {
OnReconnectNotify backoff.Notify
OnConnect sse.ConnCallback
OnDisconnect sse.ConnCallback
// contains filtered or unexported fields
}
type SubscribeOptionOverride ¶
type SubscribeOptionOverride struct {
// Presence turns on participating in channel presence.
Presence *BoolValue `json:"presence,omitempty"`
// JoinLeave enables sending Join and Leave messages for this client in channel.
JoinLeave *BoolValue `json:"join_leave,omitempty"`
// ForcePushJoinLeave forces sending join/leave for this client.
ForcePushJoinLeave *BoolValue `json:"force_push_join_leave,omitempty"`
// ForcePositioning on says that client will additionally sync its position inside
// a stream to prevent message loss. Make sure you are enabling ForcePositioning in channels
// that maintain Publication history stream. When ForcePositioning is on Centrifuge will
// include StreamPosition information to subscribe response - for a client to be able
// to manually track its position inside a stream.
ForcePositioning *BoolValue `json:"force_positioning,omitempty"`
// ForceRecovery turns on recovery option for a channel. In this case client will try to
// recover missed messages automatically upon resubscribe to a channel after reconnect
// to a server. This option also enables client position tracking inside a stream
// (like ForcePositioning option) to prevent occasional message loss. Make sure you are using
// ForceRecovery in channels that maintain Publication history stream.
ForceRecovery *BoolValue `json:"force_recovery,omitempty"`
}
type SubscribeOptions ¶
type SubscribeOptions struct {
// Info defines custom channel information, zero value means no channel information.
Info json.RawMessage `json:"info,omitempty"`
// Base64Info is like Info but for binary.
Base64Info string `json:"b64info,omitempty"`
// Data to send to a client with Subscribe Push.
Data json.RawMessage `json:"data,omitempty"`
// Base64Data is like Data but for binary data.
Base64Data string `json:"b64data,omitempty"`
// Override channel options can contain channel options overrides.
Override *SubscribeOptionOverride `json:"override,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.