Documentation ¶
Overview ¶
Package mqtt provides support for handling messages from the gateway and emitting messages to the gateway using MQTT
Index ¶
- func NewBroker(t *testing.T) (*mqtt.Server, *url.URL)
- func NewEmitter(opts ...Opt[Emitter]) transport.Emitter
- type Emitter
- type Listener
- type Opt
- func WithMqttBrokerUrl[T Emitter | Listener](brokerUrl *url.URL) Opt[T]
- func WithMqttBrokerUrls[T Emitter | Listener](brokerUrls []*url.URL) Opt[T]
- func WithMqttConnectSettings[T Emitter | Listener](mqttConnectTimeout, mqttConnectRetryDelay, mqttKeepAliveInterval time.Duration) Opt[T]
- func WithMqttGroup[T Listener](mqttGroup string) Opt[T]
- func WithMqttPrefix[T Emitter | Listener](mqttPrefix string) Opt[T]
- func WithOtelTracer[T Emitter | Listener](tracer trace.Tracer) Opt[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Emitter ¶
Emitter is an implementation of transport.Emitter that uses MQTT as the transport.
Messages are published on a topic that is composed of a number of elements: <prefix>/out/<ocpp-version>/<cs-id>. The prefix is configured, the ocpp-version and cs-id are provided to the Emit function. If not configured the default prefix is `cs`.
The Emitter defaults to connecting to a broker on 127.0.0.1:1883.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
func (*Listener) Connect ¶
func (l *Listener) Connect(ctx context.Context, ocppVersion transport.OcppVersion, chargeStationId *string, handler transport.MessageHandler) (transport.Connection, error)
type Opt ¶
type Opt[T any] func(h *T)
func WithMqttBrokerUrls ¶
func WithMqttConnectSettings ¶
func WithMqttGroup ¶
Click to show internal directories.
Click to hide internal directories.