hub

package
v0.0.0-...-377890d Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: GPL-3.0 Imports: 9 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 {
	sync.RWMutex
	// contains filtered or unexported fields
}

Hub manages subscribed clients and message broadcast

func New

func New() *Hub

New returns a broadcasting hub

func (*Hub) BroadcastScript

func (h *Hub) BroadcastScript(interpreter, script string)

BroadcastScript starts a script and broadcast its output

func (*Hub) Control

func (h *Hub) Control() http.HandlerFunc

Control starts and stops script from running

func (*Hub) Run

func (h *Hub) Run()

Run starts hub client manager and messages broadcasting

func (*Hub) ServeHTTP

func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles upgrading and maintaining websocket connection with client

type UserInfo

type UserInfo struct {
	Password string `json:"password"`
	Role     string `json:"role"`
}

UserInfo stores role and password

type WSClient

type WSClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

WSClient stores the queued messages and websocket information

Jump to

Keyboard shortcuts

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