Skip to content

Commit ebccd16

Browse files
committed
websocket: Add a bit of API doc
1 parent c413ac6 commit ebccd16

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

pkg/crc/api/websocket/endpoint.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import (
55
"sync"
66
)
77

8+
// websocket endpoint such as "/status". It has a number of clients connected
9+
// to it, and works together with an EndpointHandler to listen for the data to
10+
// send to its clients.
811
type Endpoint interface {
912
addClient(client *wsClient)
1013
deleteClient(client *wsClient)

pkg/crc/api/websocket/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"io"
55
)
66

7+
// An EndpointHandler tells a set of listeners when they should be generating
8+
// data for sending to clients.
79
type EndpointHandler struct {
810
listeners []ConnectionListener
911
dataSender io.Writer

pkg/crc/api/websocket/status.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111

1212
type genData func() (interface{}, error)
1313

14+
// A data generator for a websocket endpoint. It will fetch data at regular intervals, and
15+
// send it to all clients connected to the endpoint.
1416
type TickListener struct {
1517
done chan bool
1618
generator genData

0 commit comments

Comments
 (0)