mqttshim

package module
v0.0.0-...-ea3ada5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 5 Imported by: 0

README

MQTT Shim

How hard is it to accept all MQTT connections and print the received messages to stdout?

Turns out, not that hard.

Running a server

Start an MQTT server like this (requires docker):

./auto/run

Sending test messages

I'm on debian, and mosquitto is available by default:

$ apt-get install mosquitto-clients

Then, send a message to localhost:

$ mosquitto_pub -t foo -m 10 -q 0

The server output should look something like:

./auto/run 
2019/10/03 11:42:47 mqttshim started on 0.0.0.0:1883
msg: <Connect ClientID="mosq-uLOcLFQKaOnRWftpXQ" KeepAlive=60 Username="" Password="" CleanSession=true Will=nil Version=4>
msg: <Publish ID=0 Message=<Message Topic="foo" QOS=0 Retain=false Payload=[49 48]> Dup=false>
msg: <Disconnect>

Helpful reading

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MqttShim

type MqttShim struct{}

func NewMqttShim

func NewMqttShim() *MqttShim

func (*MqttShim) StartServer

func (shim *MqttShim) StartServer(bindAddress string, port int) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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