Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTimeout = errors.New("timed out") ErrEmptyBrokerAddress = errors.New("broker address is empty") ErrMissingAPIToken = errors.New("api token has not been set") ErrMissingCollectionID = errors.New("collection ID has not been set") )
errors
Functions ¶
func ContextWithAuth ¶
ContextWithAuth returns a context with the API token set
Types ¶
type DataStream ¶
DataStream is a stream of data from the Span service. The data stream uses a websocket under the hood.
func NewCollectionDataStream ¶
func NewCollectionDataStream(ctx context.Context, config *spanapi.Configuration, collectionID string) (DataStream, error)
NewCollectionDataStream creates a live data stream for devices in a collection. The context must contain the appropriate credentials.
func NewDeviceDataStream ¶
func NewDeviceDataStream(ctx context.Context, config *spanapi.Configuration, collectionID, deviceID string) (DataStream, error)
NewDeviceDataStream creates a live data stream for a single device. The context must contain the appropriate credentials.
func NewMQTTStream ¶ added in v4.2.3
func NewMQTTStream(options ...MQTTOption) (DataStream, error)
NewMQTTStream creates a new data stream that uses the Span MQTT broker
type MQTTOption ¶ added in v4.2.3
type MQTTOption func(opt *mqttParam) *mqttParam
MQTTOption is an option type for MQTT streams
func WithAPIToken ¶ added in v4.2.3
func WithAPIToken(token string) MQTTOption
WithAPIToken sets the API token to use when streaming data
func WithBrokerOverride ¶ added in v4.2.3
func WithBrokerOverride(broker string) MQTTOption
WithBrokerOverride overrides the default MQTT broker endpoint.
func WithClientID ¶ added in v4.2.3
func WithClientID(id string) MQTTOption
WithClientID sets the client ID to use.
func WithCollectionID ¶ added in v4.2.3
func WithCollectionID(collectionID string) MQTTOption
WithCollectionID sets the collection ID to use when streaming data