Documentation ¶
Index ¶
- type Application
- func (a *Application) AddChannel(c *channel.Channel)
- func (a *Application) Channels() []*channel.Channel
- func (a *Application) Connect(conn *connection.Connection)
- func (a *Application) Disconnect(socketID string)
- func (a *Application) FindChannelByChannelID(n string) (*channel.Channel, error)
- func (a *Application) FindConnection(socketID string) (*connection.Connection, error)
- func (a *Application) FindOrCreateChannelByChannelID(n string) *channel.Channel
- func (a *Application) PresenceChannels() []*channel.Channel
- func (a *Application) PrivateChannels() []*channel.Channel
- func (a *Application) PublicChannels() []*channel.Channel
- func (a *Application) Publish(c *channel.Channel, event events.Raw, ignore string) error
- func (a *Application) RemoveChannel(c *channel.Channel)
- func (a *Application) Subscribe(c *channel.Channel, conn *connection.Connection, data string) error
- func (a *Application) TriggerChannelOccupiedHook(c *channel.Channel)
- func (a *Application) TriggerChannelVacatedHook(c *channel.Channel)
- func (a *Application) TriggerClientEventHook(c *channel.Channel, s *subscription.Subscription, clientEvent string, ...)
- func (a *Application) TriggerMemberAddedHook(c *channel.Channel, s *subscription.Subscription)
- func (a *Application) TriggerMemberRemovedHook(c *channel.Channel, s *subscription.Subscription)
- func (a *Application) Unsubscribe(c *channel.Channel, conn *connection.Connection) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { sync.RWMutex Name string AppID string Key string Secret string OnlySSL bool Enabled bool UserEvents bool WebHooks bool URLWebHook string Stats *expvar.Map `json:"-"` // contains filtered or unexported fields }
Application represents a Pusher application
func NewApplication ¶
func NewApplication( name, appID, key, secret string, onlySSL, enabled, userEvents, webHooks bool, webHookURL string, ) *Application
NewApplication returns a new Application
func (*Application) AddChannel ¶
func (a *Application) AddChannel(c *channel.Channel)
AddChannel Add a new Channel to this APP
func (*Application) Channels ¶
func (a *Application) Channels() []*channel.Channel
Channels returns the full list of channels
func (*Application) Connect ¶
func (a *Application) Connect(conn *connection.Connection)
Connect a new Subscriber
func (*Application) Disconnect ¶
func (a *Application) Disconnect(socketID string)
Disconnect Socket
func (*Application) FindChannelByChannelID ¶
func (a *Application) FindChannelByChannelID(n string) (*channel.Channel, error)
FindChannelByChannelID Find the Channel by Channel ID
func (*Application) FindConnection ¶
func (a *Application) FindConnection(socketID string) (*connection.Connection, error)
FindConnection Find a Connection on this Application
func (*Application) FindOrCreateChannelByChannelID ¶
func (a *Application) FindOrCreateChannelByChannelID(n string) *channel.Channel
FindOrCreateChannelByChannelID Returns a Channel from this Application If not found then the Channel is created and added to this Application
func (*Application) PresenceChannels ¶
func (a *Application) PresenceChannels() []*channel.Channel
PresenceChannels Only Presence channels
func (*Application) PrivateChannels ¶
func (a *Application) PrivateChannels() []*channel.Channel
PrivateChannels Only Private channels
func (*Application) PublicChannels ¶
func (a *Application) PublicChannels() []*channel.Channel
PublicChannels Only Public channels
func (*Application) RemoveChannel ¶
func (a *Application) RemoveChannel(c *channel.Channel)
RemoveChannel removes the Channel from Application
func (*Application) Subscribe ¶
func (a *Application) Subscribe(c *channel.Channel, conn *connection.Connection, data string) error
Subscribe the connection into the given channel
func (*Application) TriggerChannelOccupiedHook ¶
func (a *Application) TriggerChannelOccupiedHook(c *channel.Channel)
TriggerChannelOccupiedHook channel_occupied { "name": "channel_occupied", "channel": "test_channel" }
func (*Application) TriggerChannelVacatedHook ¶
func (a *Application) TriggerChannelVacatedHook(c *channel.Channel)
TriggerChannelVacatedHook channel_vacated { "name": "channel_vacated", "channel": "test_channel" }
func (*Application) TriggerClientEventHook ¶
func (a *Application) TriggerClientEventHook(c *channel.Channel, s *subscription.Subscription, clientEvent string, data interface{})
TriggerClientEventHook client_events
{ "name": "client_event", "channel": "name of the channel the event was published on", "event": "name of the event", "data": "data associated with the event", "socket_id": "socket_id of the sending socket", "user_id": "user_id associated with the sending socket" # Only for presence channels }
func (*Application) TriggerMemberAddedHook ¶
func (a *Application) TriggerMemberAddedHook(c *channel.Channel, s *subscription.Subscription)
TriggerMemberAddedHook member_added
{ "name": "member_added", "channel": "presence-your_channel_name", "user_id": "a_user_id" }
func (*Application) TriggerMemberRemovedHook ¶
func (a *Application) TriggerMemberRemovedHook(c *channel.Channel, s *subscription.Subscription)
TriggerMemberRemovedHook member_removed
{ "name": "member_removed", "channel": "presence-your_channel_name", "user_id": "a_user_id" }
func (*Application) Unsubscribe ¶
func (a *Application) Unsubscribe(c *channel.Channel, conn *connection.Connection) error
Unsubscribe unsubscribe the given connection from the channel remove the channel from the application if it is empty