Documentation ¶
Index ¶
- Constants
- type Channel
- func (c Channel) Delete(w http.ResponseWriter, r *http.Request) error
- func (c Channel) Index(w http.ResponseWriter, r *http.Request) error
- func (c Channel) Show(w http.ResponseWriter, r *http.Request) error
- func (c Channel) Store(w http.ResponseWriter, r *http.Request) error
- func (c Channel) Update(w http.ResponseWriter, r *http.Request) error
- type TelemetryServer
Constants ¶
View Source
const ( // How long (in bytes) the random IDs should be ID_LEN = 6 // How many messages to queue for the client before the connection // is dropped for being too slow. BUF_LEN = 16 )
View Source
const ( // Challenge passed. WS_CHALLENGE_SUCCESS = iota + 4000 // Server expects the next client message to contain a password. WS_CHALLENGE_PASSWORD )
Application-defined status codes. See: https://tools.ietf.org/html/rfc6455#section-7.4.2
Challenge responses
View Source
const ( // Malformed message data received. WS_ERROR_BAD_MSG = iota + 4400 // Invalid login attempt. WS_ERROR_UNAUTHORISED // Permission denied. WS_ERROR_FORBIDDEN // Object not found. WS_ERROR_NOT_FOUND // Took too long responding. WS_ERROR_TIMEOUT // Publisher/subscriber channel is full and the client cannot be added // until a publisher/subscriber disconnects. WS_ERROR_CHANNEL_FULL )
Error codes
View Source
const (
// Maximum number of clients listening.
MAX_SUBS = 10
)
View Source
const ( // No error occurred in the last message. WS_OK = iota + 4200 )
Informational
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
CRUD controller that manipulates channel data in the provided repository.
func NewChannel ¶
func NewChannel(channels are_hub.ChannelRepo) Channel
Create a new channel controller.
type TelemetryServer ¶
type TelemetryServer struct {
// contains filtered or unexported fields
}
Handles receiving data from publishers and forwarding that data along to subscribers on the same channel.
func NewTelemetryServer ¶
func NewTelemetryServer(o *websocket.AcceptOptions, r are_hub.ChannelRepo) *TelemetryServer
Create a new telemetry server.
func (*TelemetryServer) Publish ¶
func (ts *TelemetryServer) Publish(w http.ResponseWriter, r *http.Request) error
Broadcast messages to connected clients (connected via websockets).
func (*TelemetryServer) Subscribe ¶
func (ts *TelemetryServer) Subscribe(w http.ResponseWriter, r *http.Request) error
Handle upgrade subscriber clients to a websocket.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.