Documentation
¶
Index ¶
Constants ¶
View Source
const ( OperationReloadStarted = "reload.started" OperationReloadEnded = "reload.ended" OperationDataUpdated = "data.updated" OperationAttributesUpdated = "attributes.updated" OperationResult = "result" OperationUpdated = "updated" )
Constants for known operations
View Source
const ( ResourceTypeApp = "app" ResourceTypeReload = "reload" ResourceTypeEvaluation = "evaluation" )
Constants for known ResourceType
View Source
const BufferSize = 20
View Source
const WsType = "EventWebsocket"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Operation string `json:"operation,omitempty"`
Origin string `json:"origin,omitempty"`
ResourceID string `json:"resourceId,omitempty"`
ResourceType string `json:"resourceType,omitempty"`
Success bool `json:"success,omitempty"`
Time string `json:"time,omitempty"`
SpaceId string `json:"spaceId,omitempty"`
ReloadId string `json:"reloadId,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
}
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler handles events received on event websocket
func NewEventHandler ¶
func NewEventHandler() *EventHandler
NewEventHandler creates a new EventHandler which can be registered to and EventWs,
func (*EventHandler) DeRegisterFunc ¶
func (handler *EventHandler) DeRegisterFunc(eventFunc *EventFunc)
DeRegisterFunc from execution on event triggering
func (*EventHandler) FakeEvent ¶
func (handler *EventHandler) FakeEvent(event Event)
FakeEvent fake event being received
func (*EventHandler) RegisterFunc ¶
func (handler *EventHandler) RegisterFunc(operation string, f func(event Event), replay bool) *EventFunc
RegisterFunc to be executed on event triggering replay: triggers the latest events from buffer upon creation
type EventWebsocket ¶
type EventWebsocket struct {
*EventHandler
*wsdialer.WsDialer
}
func SetupEventSocket ¶
func SetupEventSocket(dialContext context.Context, listenContext context.Context, timeout time.Duration, cookieJar http.CookieJar, trafficLogger TrafficLogger, metricsLogger TrafficMetricsLogger, url *neturl.URL, httpHeader http.Header, allowUntrusted bool, requestMetrics *requestmetrics.RequestMetrics, currentActionState func() *action.State) (*EventWebsocket, error)
SetupEventSocket to listen for events, event listening will stop at listenContext done.
type TrafficLogger ¶
type TrafficLogger interface {
Received([]byte)
Opened()
}
Click to show internal directories.
Click to hide internal directories.