Go API Documentation

github.com/semaphoreui/semaphore/api/sockets

No package summary is available.

Package

Files: 2. Third party imports: 3. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Constants

Vars

Types

connection

This type doesn't have documentation.

Field name Field type Comment
ws

*websocket.Conn

No comment on field.
send

chan []byte

No comment on field.
userID

int

No comment on field.

hub

hub maintains the set of active connections and broadcasts messages to the connections.

Field name Field type Comment
connections

map[*connection]bool

Registered websocket connections.

broadcast

chan *sendRequest

Inbound messages from the connections.

register

chan *connection

Register requests from the connections.

unregister

chan *connection

Unregister requests from connections.

sendRequest

This type doesn't have documentation.

Field name Field type Comment
userID

int

No comment on field.
msg

[]byte

No comment on field.

Functions

func Handler

Handler is used by the router to handle the /ws endpoint

Uses: context.Get, db.User, http.StatusInternalServerError, log.Fields, log.WithError.

func Message

Message allows a message to be sent to the websockets, called in API task logging

func StartWS

StartWS starts the web sockets in a goroutine

Private functions

func log

References: log.Fields, log.WithError.

func logDebug

References: log.DebugLevel.

func logError

References: log.ErrorLevel.

func logWarn

References: log.DebugLevel.

func readPump

readPump pumps messages from the websocket connection to the hub.

References: fmt.Println, tz.Now, websocket.CloseGoingAway, websocket.IsUnexpectedCloseError.

func write

write writes a message with the given message type and payload.

References: tz.Now.

func writePump

writePump pumps messages from the hub to the websocket connection.

References: time.NewTicker, websocket.CloseMessage, websocket.PingMessage, websocket.TextMessage.

func run

References: log.Fields, log.WithFields.