websocket

package
v0.0.0-...-78446d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockChainHub = newHub("blockchain")

BlockChainHub hub for pool of websocket connections related to commentron.

View Source
var CommentronHub = newHub("commentron")

CommentronHub hub for pool of websocket connections related to commentron.

View Source
var InternalAPIsHub = newHub("internal-apis")

InternalAPIsHub hub for pool of websocket connections related to internal-apis.

Functions

func SubscribeBlockChain

func SubscribeBlockChain() http.Handler

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

func SubscribeCommentron() http.Handler

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

func SubscribeInternalAPIs() http.Handler

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

func (h *Hub) SocketCountByID(id string) uint64

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL