Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BlockChainHub = newHub("blockchain")
BlockChainHub hub for pool of websocket connections related to commentron.
var CommentronHub = newHub("commentron")
CommentronHub hub for pool of websocket connections related to commentron.
var InternalAPIsHub = newHub("internal-apis")
InternalAPIsHub hub for pool of websocket connections related to internal-apis.
Functions ¶
func SubscribeBlockChain ¶
SubscribeBlockChain is the default handler for connecting a websocket. `to` is what is being subscribed to and is the service associated with the path url.
func SubscribeCommentron ¶
SubscribeCommentron is the default handler for connecting a websocket. `to` is what is being subscribed to and is the service associated with the path url.
func SubscribeInternalAPIs ¶
SubscribeInternalAPIs is the default handler for connecting a websocket. `to` is what is being subscribed to and is the service associated with the path url.
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.
func (*Hub) Broadcast ¶
func (h *Hub) Broadcast(n *push.Notification) error
Broadcast sends the message over all websocket connections
func (*Hub) PushTo ¶
func (h *Hub) PushTo(n *push.Notification, ids []string)
PushTo pushes a notification to a specific id connections
func (*Hub) PushToSync ¶
func (h *Hub) PushToSync(n *push.Notification, ids []string) error
PushToSync pushes the notification synchronously with error if failed
func (*Hub) SocketCountByID ¶
SocketCountByID returns the number of websocket connections for a particular client id
type PushNotification ¶
type PushNotification struct { Type string `json:"type"` Data map[string]interface{} `json:"data,omitempty"` // contains filtered or unexported fields }
PushNotification Format of the messages going over the websocket