Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Broadcast ¶
func Broadcast(notification *PushNotification) error
Broadcast sends a PushNotification to all connected clients
func PushTo ¶
func PushTo(notification *PushNotification, subscriptionID string)
PushTo sends the PushNotification to the subscribed clients
func SubscribeLiveChat ¶
SubscribeLiveChat is a handler to accept web socket subscriptions for a live chat
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to the clients.
type PushNotification ¶
type PushNotification struct { Type string `json:"type"` Data map[string]interface{} `json:"data,omitempty"` }
PushNotification is a message format that tells the client the type of message and the content
Click to show internal directories.
Click to hide internal directories.