Documentation
¶
Overview ¶
Package pubsub contains LISTEN/NOTIFY structs for v2 poll data and v3 poller control
Index ¶
- Constants
- type Listener
- type Notifier
- type PartialWrapper
- type Payload
- type V2AccountData
- type V2Accumulate
- type V2DeviceData
- type V2InitialSyncComplete
- type V2Initialise
- type V2InviteRoom
- type V2LeaveRoom
- type V2Pub
- type V2Receipt
- type V2Sub
- type V2SubReceiver
- type V2Typing
- type V2UnreadCounts
- type V3EnsurePolling
- type V3Pub
- type V3Sub
- type V3SubReceiver
- type Wrapper
Constants ¶
const ChanV2 = "v2ch"
The channel which has V2* payloads
const ChanV3 = "v3ch"
The channel which has V3* payloads
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener interface { // Begin listening on this channel with this callback starting from this position. Blocks until Close() is called. Listen(chanName string, start int64, fn func(p PartialWrapper)) error // Close the listener. No more callbacks should fire. Close() error }
Listener represents the common functions required by all subscription listeners
type Notifier ¶
type Notifier interface { // Notify chanName that there is a new payload p. Return an error if we failed to send the notification. Notify(chanName string, p Payload) error }
Notifier represents the common functions required by all notifiers
type PartialWrapper ¶
type PartialWrapper struct { PayloadType string `json:"t"` Payload json.RawMessage `json:"p"` }
PartialWrapper partially decodes Wrapper, enough to work out the type of payload.
func (PartialWrapper) Type ¶
func (p PartialWrapper) Type() string
type Payload ¶
type Payload interface {
Type() string
}
Every payload needs a type to distinguish what kind of update it is.
type V2AccountData ¶
func (V2AccountData) Type ¶
func (v V2AccountData) Type() string
type V2Accumulate ¶
func (V2Accumulate) Type ¶
func (v V2Accumulate) Type() string
type V2DeviceData ¶
type V2DeviceData struct {
Pos int64
}
func (V2DeviceData) Type ¶
func (v V2DeviceData) Type() string
type V2InitialSyncComplete ¶
func (V2InitialSyncComplete) Type ¶
func (v V2InitialSyncComplete) Type() string
type V2Initialise ¶
func (V2Initialise) Type ¶
func (v V2Initialise) Type() string
type V2InviteRoom ¶
func (V2InviteRoom) Type ¶
func (v V2InviteRoom) Type() string
type V2LeaveRoom ¶
func (V2LeaveRoom) Type ¶
func (v V2LeaveRoom) Type() string
type V2Pub ¶
type V2Pub struct {
// contains filtered or unexported fields
}
V2Pub receives v2 data and persists it in the DB, then sends NOTIFY updates.
type V2Sub ¶
type V2Sub struct {
// contains filtered or unexported fields
}
func NewV2Sub ¶
func NewV2Sub(l Listener, recv V2SubReceiver) *V2Sub
type V2SubReceiver ¶
type V2SubReceiver interface { Initialise(p *V2Initialise) Accumulate(p *V2Accumulate) OnAccountData(p *V2AccountData) OnInvite(p *V2InviteRoom) OnLeftRoom(p *V2LeaveRoom) OnUnreadCounts(p *V2UnreadCounts) OnInitialSyncComplete(p *V2InitialSyncComplete) OnDeviceData(p *V2DeviceData) OnTyping(p *V2Typing) OnReceipt(p *V2Receipt) }
type V2Typing ¶ added in v0.7.2
type V2Typing struct { RoomID string EphemeralEvent json.RawMessage }
type V2UnreadCounts ¶
type V2UnreadCounts struct { UserID string RoomID string HighlightCount *int NotificationCount *int }
func (V2UnreadCounts) Type ¶
func (v V2UnreadCounts) Type() string
type V3EnsurePolling ¶
func (V3EnsurePolling) Type ¶
func (v V3EnsurePolling) Type() string
type V3Pub ¶
type V3Pub struct {
// contains filtered or unexported fields
}
V3Pub sends signalling messages to v2 pollers
func (*V3Pub) EnsurePolling ¶
EnsurePolling blocks until the V2InitialSyncComplete response is received for this device. It is the caller's responsibility to call OnInitialSyncComplete when new events arrive.
func (*V3Pub) OnInitialSyncComplete ¶
func (p *V3Pub) OnInitialSyncComplete(payload *V2InitialSyncComplete)
type V3Sub ¶
type V3Sub struct {
// contains filtered or unexported fields
}
func NewV3Sub ¶
func NewV3Sub(l Listener, recv V3SubReceiver) *V3Sub
type V3SubReceiver ¶
type V3SubReceiver interface {
EnsurePolling(p *V3EnsurePolling)
}