webserver

package
v0.0.0-...-9c02efb Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BroadcastData

func BroadcastData(message []byte)

BroadcastData Broadcasts array of bytes to all Ws clients

func DebugMsg

func DebugMsg(msg string)

DebugMsg Broadcast msg of the type DEBUG

func Start

func Start()

Start starts Ws server

func WsPage

func WsPage(res http.ResponseWriter, req *http.Request)

WsPage Websocket page handler

Types

type Client

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

Client User that successfully connects to Ws

type ClientManager

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

ClientManager Server Manager used to relay Websocket messages/chan/wait

func (*ClientManager) Send

func (manager *ClientManager) Send(message []byte, ignore *Client)

Send sends Raw data to all clients except the one given

type ContentData

type ContentData struct {
	Time int64  `json:"time"`
	Data string `json:"msg"`
}

ContentData Message raw data with Timestamp

type Event

type Event string

Event sent to Clients signaling message type

const (
	DEBUG    Event = "debug" // DEBUG state
	MATCH    Event = "match"
	STATE    Event = "state"
	WARNING  Event = "warning"
	ANNOUNCE Event = "announcement"
)

type MatchServer

type MatchServer struct {
	Port     int
	Hostname string
	CertFile string
}

MatchServer Options passed during creation

func (MatchServer) PushLogEntry

func (ms MatchServer) PushLogEntry(entry log.Entry) error

PushLogEntry Broadcasts given Logrus Entry to all websocket clients

func (MatchServer) PushMatch

func (ms MatchServer) PushMatch(match crawler.Match) error

PushMatch Broadcasts given Match to all websocket clients

func (MatchServer) PushState

func (ms MatchServer) PushState(state []crawler.TaskState) error

PushState Broadcasts given CrawlerState to all websocket clients

func (MatchServer) Setup

func (ms MatchServer) Setup()

Setup Sets up the MatchServer with it's listeners

type Message

type Message struct {
	Sender    string      `json:"sender,omitempty"`
	Event     Event       `json:"event"`
	Recipient string      `json:"recipient,omitempty"`
	Content   interface{} `json:"data,omitempty"`
	Time      int64       `json:"time"`
}

Message Telemetry sent to Client with arbitrary json `data`

Jump to

Keyboard shortcuts

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