Documentation ¶
Index ¶
- Variables
- func BuildRoutes(r *Repo) http.Handler
- func ListenHandler(repo *Repo) http.HandlerFunc
- func LoginHandler(repo *Repo) http.HandlerFunc
- func NewClient(ctx context.Context, conn WebSocketConnection, device *datastore.Device, ...)
- type AckEventDelivery
- type CLIEvent
- type Client
- func (c *Client) Close(unregister chan *Client)
- func (c *Client) GoOffline(ctx context.Context)
- func (c *Client) IsOnline() bool
- func (c *Client) ResendEventDeliveries(ctx context.Context, since time.Time, events chan *CLIEvent)
- func (c *Client) UpdateEventDeliveryStatus(ctx context.Context, id, projectId string)
- type EndpointError
- type EventDelivery
- type Hub
- func (h *Hub) EventDeliveryCLiHandler(r *Repo) func(context.Context, *asynq.Task) error
- func (h *Hub) Start(ctx context.Context)
- func (h *Hub) StartClientStatusWatcher(ctx context.Context)
- func (h *Hub) StartEventSender(ctx context.Context)
- func (h *Hub) StartRegister()
- func (h *Hub) StartUnregister()
- func (h *Hub) Stop()
- type ListenRequest
- type LoginRequest
- type LoginResponse
- type ProjectDevice
- type Repo
- type WebSocketConnection
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFailedToUpdateDevice = errors.New("failed to update device last seen") ErrFailedToSendPongMessage = errors.New("failed to write pong message") )
Functions ¶
func BuildRoutes ¶
func ListenHandler ¶
func ListenHandler(repo *Repo) http.HandlerFunc
func LoginHandler ¶
func LoginHandler(repo *Repo) http.HandlerFunc
func NewClient ¶
func NewClient(ctx context.Context, conn WebSocketConnection, device *datastore.Device, sourceID string, deviceRepo datastore.DeviceRepository, eventDeliveryRepo datastore.EventDeliveryRepository)
Types ¶
type AckEventDelivery ¶
type AckEventDelivery struct {
UID string `json:"uid"`
}
type CLIEvent ¶
type CLIEvent struct { UID string `json:"uid"` Headers httpheader.HTTPHeader `json:"headers" bson:"headers"` Data json.RawMessage `json:"data"` // for filtering this event delivery EventType string `json:"-"` DeviceID string `json:"-"` EndpointID string `json:"-"` SourceID string `json:"-"` ProjectID string `json:"-"` }
type Client ¶
Client is a middleman between the websocket connection and the hub.
func (*Client) ResendEventDeliveries ¶
type EndpointError ¶ added in v0.9.0
type EndpointError struct { Err error // contains filtered or unexported fields }
func (*EndpointError) Delay ¶ added in v0.9.0
func (e *EndpointError) Delay() time.Duration
func (*EndpointError) Error ¶ added in v0.9.0
func (e *EndpointError) Error() string
type EventDelivery ¶ added in v0.9.0
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to the clients.
func (*Hub) EventDeliveryCLiHandler ¶ added in v0.9.0
func (*Hub) StartClientStatusWatcher ¶
func (*Hub) StartEventSender ¶
func (*Hub) StartRegister ¶
func (h *Hub) StartRegister()
func (*Hub) StartUnregister ¶
func (h *Hub) StartUnregister()
type ListenRequest ¶
type ListenRequest struct { HostName string `json:"host_name" valid:"required~please provide a hostname"` ProjectID string `json:"project_id" valid:"required~please provide a project id"` DeviceID string `json:"device_id" valid:"required~please provide a device id"` SourceID string `json:"-"` SourceName string `json:"source_name"` }
type LoginRequest ¶
type LoginRequest struct {
HostName string `json:"host_name" valid:"required~please provide a hostname"`
}
type LoginResponse ¶
type LoginResponse struct { Projects []ProjectDevice `json:"projects"` UserName string `json:"user_name"` }
type ProjectDevice ¶ added in v0.8.2
type Repo ¶
type Repo struct { OrgMemberRepository datastore.OrganisationMemberRepository ProjectRepo datastore.ProjectRepository DeviceRepo datastore.DeviceRepository SourceRepo datastore.SourceRepository EndpointRepo datastore.EndpointRepository SubscriptionRepo datastore.SubscriptionRepository EventDeliveryRepo datastore.EventDeliveryRepository Queue queue.Queuer }
Click to show internal directories.
Click to hide internal directories.