notification

package
v0.0.0-...-ca671ec Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

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

Hub is a hub of websocket connections. Those connections are connected to each other via this hub.

func NewHub

func NewHub(ctx context.Context) *Hub

NewHub returns a new hub which is accepting notifications and connections. The hub stops accepting new requests when "ctx" is canceled.

func (*Hub) AcceptConnection

func (h *Hub) AcceptConnection(ws *websocket.Conn)

AcceptConnection receives a websocket connection and register it as a subscriber of broadcast notifications.

func (*Hub) Broadcast

func (h *Hub) Broadcast(msg string)

Broadcast sends "msg" to the registered connections.

Jump to

Keyboard shortcuts

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