Documentation ¶
Index ¶
- func WithChannelOccupiedListener(f ListenerFunc) func(*Channel)
- func WithChannelVacatedListener(f ListenerFunc) func(*Channel)
- func WithClientEventListener(f ClientEventListenerFunc) func(*Channel)
- func WithMemberAddedListener(f ListenerFunc) func(*Channel)
- func WithMemberRemovedListener(f ListenerFunc) func(*Channel)
- type Channel
- func (c *Channel) IsOccupied() bool
- func (c *Channel) IsPresence() bool
- func (c *Channel) IsPresenceOrPrivate() bool
- func (c *Channel) IsPrivate() bool
- func (c *Channel) IsPublic() bool
- func (c *Channel) IsSubscribed(conn *connection.Connection) bool
- func (c *Channel) Publish(event events.Raw, ignore string) error
- func (c *Channel) PublishMemberAddedEvent(data string, subscription *subscription.Subscription)
- func (c *Channel) PublishMemberRemovedEvent(subscription *subscription.Subscription)
- func (c *Channel) Subscribe(conn *connection.Connection, channelData string) error
- func (c *Channel) Subscriptions() []*subscription.Subscription
- func (c *Channel) TotalSubscriptions() int
- func (c *Channel) TotalUsers() int
- func (c *Channel) Unsubscribe(conn *connection.Connection) error
- type ClientEventListenerFunc
- type ListenerFunc
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithChannelOccupiedListener ¶
func WithChannelOccupiedListener(f ListenerFunc) func(*Channel)
WithChannelOccupiedListener appends the given ListenerFunc into the channelOccupiedListeners list
func WithChannelVacatedListener ¶
func WithChannelVacatedListener(f ListenerFunc) func(*Channel)
WithChannelVacatedListener appends the given ListenerFunc into the channelVacatedListeners list
func WithClientEventListener ¶
func WithClientEventListener(f ClientEventListenerFunc) func(*Channel)
WithClientEventListener appends the given ListenerFunc into the clientEventListeners list
func WithMemberAddedListener ¶
func WithMemberAddedListener(f ListenerFunc) func(*Channel)
WithMemberAddedListener appends the given ListenerFunc into the memberAddedListeners list
func WithMemberRemovedListener ¶
func WithMemberRemovedListener(f ListenerFunc) func(*Channel)
WithMemberRemovedListener appends the given ListenerFunc into the memberRemovedListeners list
Types ¶
type Channel ¶
Channel represents an application channel
func (*Channel) IsOccupied ¶
IsOccupied Return true if the Channel has at least one subscriber
func (*Channel) IsPresence ¶
IsPresence Check if the type of the Channel is presence
func (*Channel) IsPresenceOrPrivate ¶
IsPresenceOrPrivate Check if the type of the Channel is presence or is private
func (*Channel) IsSubscribed ¶
func (c *Channel) IsSubscribed(conn *connection.Connection) bool
IsSubscribed check if the user is subscribed
func (*Channel) PublishMemberAddedEvent ¶
func (c *Channel) PublishMemberAddedEvent(data string, subscription *subscription.Subscription)
PublishMemberAddedEvent Publish a MemberAddedEvent to all subscriptions
func (*Channel) PublishMemberRemovedEvent ¶
func (c *Channel) PublishMemberRemovedEvent(subscription *subscription.Subscription)
PublishMemberRemovedEvent Publish a MemberRemovedEvent to all subscriptions
func (*Channel) Subscribe ¶
func (c *Channel) Subscribe(conn *connection.Connection, channelData string) error
Subscribe Add a new subscriber to the Channel
func (*Channel) Subscriptions ¶
func (c *Channel) Subscriptions() []*subscription.Subscription
Subscriptions returns a slice of subscriptions
func (*Channel) TotalSubscriptions ¶
TotalSubscriptions Get the total of subscribers
func (*Channel) Unsubscribe ¶
func (c *Channel) Unsubscribe(conn *connection.Connection) error
Unsubscribe Remove the subscriber from the Channel It destroy the Channel if the channels does not have any subscribers.
type ClientEventListenerFunc ¶
type ClientEventListenerFunc func(*Channel, *subscription.Subscription, string, interface{})
ClientEventListenerFunc listener for client events
type ListenerFunc ¶
type ListenerFunc func(*Channel, *subscription.Subscription)
ListenerFunc listener function