live

package
v0.88.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 8 Imported by: 13

Documentation

Overview

Package live provides access to the GrafanaLive server [ALPHA]

Index

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

type GrafanaLiveClient struct {
	Log log.Logger
	// contains filtered or unexported fields
}

GrafanaLiveClient connects to the GrafanaLive server

func InitGrafanaLiveClient

func InitGrafanaLiveClient(conn ConnectionInfo) (*GrafanaLiveClient, error)

InitGrafanaLiveClient starts a chat server

func (*GrafanaLiveClient) Subscribe

Subscribe will subscribe to a channel within the server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL