websockethub

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Apache-2.0, BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a middleman between the node and the websocket connection.

func (*Client) Send

func (c *Client) Send(msg interface{})

Send sends a message to the client

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub

func NewHub(logger *logger.Logger, upgrader *websocket.Upgrader, broadcastQueueSize int) *Hub

func (*Hub) BroadcastMsg

func (h *Hub) BroadcastMsg(msg interface{})

BroadcastMsg sends a message to all clients

func (*Hub) Run

func (h *Hub) Run(shutdownSignal <-chan struct{})

Start the hub

func (*Hub) ServeWebsocket

func (h *Hub) ServeWebsocket(w http.ResponseWriter, r *http.Request, onConnect ...func(client *Client))

ServeWebsocket handles websocket requests from the peer.

Jump to

Keyboard shortcuts

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