Documentation ¶
Overview ¶
Package live provides access to the GrafanaLive server [ALPHA]
Index ¶
- type ChannelAddress
- type ConnectionInfo
- type GrafanaLiveChannel
- func (c *GrafanaLiveChannel) OnSubscribeError(sub *centrifuge.Subscription, e centrifuge.SubscribeErrorEvent)
- func (c *GrafanaLiveChannel) OnSubscribeSuccess(sub *centrifuge.Subscription, e centrifuge.SubscribeSuccessEvent)
- func (c *GrafanaLiveChannel) OnUnsubscribe(sub *centrifuge.Subscription, e centrifuge.UnsubscribeEvent)
- func (c *GrafanaLiveChannel) Publish(data []byte)
- type GrafanaLiveClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelAddress ¶
type ChannelAddress struct { // Scope is "grafana", "ds", or "plugin". Scope string `json:"scope,omitempty"` // Namespace meaning depends on the scope. // * when Grafana, namespace is a "feature" // * when DS, namespace is the datasource ID // * when plugin, namespace is the plugin name Namespace string `json:"namespace,omitempty"` // Path is the channel path. // Within each namespace, the handler can process the path as needed. Path string `json:"path,omitempty"` }
ChannelAddress is the channel ID split by parts.
func ParseChannelAddress ¶
func ParseChannelAddress(id string) ChannelAddress
ParseChannelAddress parses the parts from a channel ID:
${scope} / ${namespace} / ${path}.
func (*ChannelAddress) IsValid ¶
func (ca *ChannelAddress) IsValid() bool
IsValid checks if all parts of the address are valid.
func (*ChannelAddress) ToChannelID ¶
func (ca *ChannelAddress) ToChannelID() string
ToChannelID converts this to a single string.
type ConnectionInfo ¶
type ConnectionInfo struct { // URL is the root Grafana HTTP URL. URL string `json:"host,omitempty"` }
ConnectionInfo contains everything a client needs to connect to the server.
func (*ConnectionInfo) ToWebSocketURL ¶
func (c *ConnectionInfo) ToWebSocketURL() (string, error)
ToWebSocketURL converts the standard HTTP URL to the expected WS URL.
type GrafanaLiveChannel ¶
type GrafanaLiveChannel struct {
// contains filtered or unexported fields
}
GrafanaLiveChannel allows access to a channel within the server
func (*GrafanaLiveChannel) OnSubscribeError ¶
func (c *GrafanaLiveChannel) OnSubscribeError(sub *centrifuge.Subscription, e centrifuge.SubscribeErrorEvent)
OnSubscribeError is called when the channel has an error
func (*GrafanaLiveChannel) OnSubscribeSuccess ¶
func (c *GrafanaLiveChannel) OnSubscribeSuccess(sub *centrifuge.Subscription, e centrifuge.SubscribeSuccessEvent)
OnSubscribeSuccess is called when the channel is subscribed
func (*GrafanaLiveChannel) OnUnsubscribe ¶
func (c *GrafanaLiveChannel) OnUnsubscribe(sub *centrifuge.Subscription, e centrifuge.UnsubscribeEvent)
OnUnsubscribe is called when the channel is unsubscribed
func (*GrafanaLiveChannel) Publish ¶
func (c *GrafanaLiveChannel) Publish(data []byte)
Publish sends the data to the channel
type GrafanaLiveClient ¶
GrafanaLiveClient connects to the GrafanaLive server
func InitGrafanaLiveClient ¶
func InitGrafanaLiveClient(conn ConnectionInfo) (*GrafanaLiveClient, error)
InitGrafanaLiveClient starts a chat server
func (*GrafanaLiveClient) Subscribe ¶
func (c *GrafanaLiveClient) Subscribe(addr ChannelAddress) (*GrafanaLiveChannel, error)
Subscribe will subscribe to a channel within the server