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 |
|
No comment on field. |
| send |
|
No comment on field. |
| userID |
|
No comment on field. |
hub
hub maintains the set of active connections and broadcasts messages to the connections.
| Field name | Field type | Comment |
|---|---|---|
| connections |
|
Registered websocket connections. |
| broadcast |
|
Inbound messages from the connections. |
| register |
|
Register requests from the connections. |
| unregister |
|
Unregister requests from connections. |
sendRequest
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| userID |
|
No comment on field. |
| msg |
|
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
func logDebug
func logError
func logWarn
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.