All Projects → rs → Moquette

rs / Moquette

Licence: mit
MQTT service dispatcher

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Moquette

Convention
🏡 The Homie Convention: a lightweight MQTT convention for the IoT
Stars: ✭ 582 (+1663.64%)
Mutual labels:  mqtt, iot
Sitewhere
SiteWhere is an industrial strength open-source application enablement platform for the Internet of Things (IoT). It provides a multi-tenant microservice-based infrastructure that includes device/asset management, data ingestion, big-data storage, and integration through a modern, scalable architecture. SiteWhere provides REST APIs for all system functionality. SiteWhere provides SDKs for many common device platforms including Android, iOS, Arduino, and any Java-capable platform such as Raspberry Pi rapidly accelerating the speed of innovation.
Stars: ✭ 788 (+2287.88%)
Mutual labels:  mqtt, iot
Inchat
一个轻量级、高效率的支持多端(应用与硬件Iot)的可分布式、异步网络应用通讯框架
Stars: ✭ 654 (+1881.82%)
Mutual labels:  mqtt, iot
Ejabberd
Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
Stars: ✭ 5,077 (+15284.85%)
Mutual labels:  mqtt, iot
React Native Aws Iot Device Shadows
React Native Component for connecting to AWS IoT Shadows from a device using SDK JavaScript bundle
Stars: ✭ 30 (-9.09%)
Mutual labels:  mqtt, iot
Hassio Zigbee2mqtt
Hass.io add-on for zigbee2mqtt
Stars: ✭ 547 (+1557.58%)
Mutual labels:  mqtt, iot
Volantmq
High-Performance MQTT Server
Stars: ✭ 785 (+2278.79%)
Mutual labels:  mqtt, iot
Hivemq Mqtt Client
HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
Stars: ✭ 402 (+1118.18%)
Mutual labels:  mqtt, iot
Hodd
Homie Device Discovery
Stars: ✭ 21 (-36.36%)
Mutual labels:  mqtt, iot
Paho.mqtt.embedded C
Paho MQTT C client library for embedded systems. Paho is an Eclipse IoT project (https://iot.eclipse.org/)
Stars: ✭ 887 (+2587.88%)
Mutual labels:  mqtt, iot
Dorita980
Unofficial iRobot Roomba and Braava (i7/i7+, 980, 960, 900, e5, 690, 675, m6, etc) node.js library (SDK) to control your robot
Stars: ✭ 523 (+1484.85%)
Mutual labels:  mqtt, iot
Rf24node msgproto
An application that runs on a Raspberry Pi that interfaces RF24Network packets to a Message Bus. Currently MQTT & AMQP (alpha); Topics are RF24SensorNet compatible.
Stars: ✭ 11 (-66.67%)
Mutual labels:  mqtt, iot
Redmatic
Node-RED packaged as Addon for the Homematic CCU3 and RaspberryMatic 🤹‍♂️
Stars: ✭ 407 (+1133.33%)
Mutual labels:  mqtt, iot
Hivemq Community Edition
HiveMQ CE is a Java-based open source MQTT broker that fully supports MQTT 3.x and MQTT 5. It is the foundation of the HiveMQ Enterprise Connectivity and Messaging Platform
Stars: ✭ 562 (+1603.03%)
Mutual labels:  mqtt, iot
Esp Mqtt
ESP32 mqtt component
Stars: ✭ 403 (+1121.21%)
Mutual labels:  mqtt, iot
Arduino Mqtt
MQTT library for Arduino
Stars: ✭ 685 (+1975.76%)
Mutual labels:  mqtt, iot
Kubeedge
Kubernetes Native Edge Computing Framework (project under CNCF)
Stars: ✭ 4,582 (+13784.85%)
Mutual labels:  mqtt, iot
Jetlinks
JetLinks Core
Stars: ✭ 380 (+1051.52%)
Mutual labels:  mqtt, iot
Thingsboard Gateway
Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
Stars: ✭ 796 (+2312.12%)
Mutual labels:  mqtt, iot
Mqttx
MQTT X - Elegant MQTT 5.0 Client Tool of Cross-platform
Stars: ✭ 892 (+2603.03%)
Mutual labels:  mqtt, iot

Moquette — MQTT Service Dispatcher

Moquette is to MQTT what inetd is to IP. Moquette listens for events from an MQTT broker and executes a process (event handler) found in its configuration directory if its name matches the event's topic. The matching obeys to the MQTT topic rules. Slashes in the topic are replaced by colon (:).

For instance, the following file names will all match the topic home/office/lamp/setOn:

  • home🏢lamp:setOn
  • home🏢+:setOn
  • home🏢#
  • #

Event handler files must be at the root of the Moquette configuration directory and have their executable flag set. The default directory is /etc/moquette.d and can be changed using the --conf option. New files can be added/removed while Moquette is running, without the need to restart it.

When an event handler is executed, Moquette sends the event payload as first argument to the command and the event topic is set as the $MQTT_TOPIC environment variable. The message ID is also transmitted using the $MQTT_MSGID environment variable.

A command can send events back by writing to the file descriptor number 3. The Format is as follow:

PUB <topic> <qos> <payload length>\n
<payload>

For instance, to send "hello world" on the example/somewhere topic using bash:

msg="hello world"
echo -e "PUB example/somewhere 0 ${#msg}\n$msg" >&3

Moquette will wait as long as necessary for the process to finish its execution. This way it is possible to delay the response to an event, or send multiple events spread in time to implement a timer for instance.

Handler Examples

The examples below are written in bash, but handlers can be written in any language. You can find more examples in the conf directory.

example:echo:+:in

#!/bin/bash

echo -e "PUB ${MQTT_TOPIC%*in}out 0 ${#1}\n$1" >&3

This handler responds to any event written on a matching topic, and sends back an event on the same topic by replacing in by out.

For instance, sending "hello world" to example/echo/test/in will send back "hello world" to the topic example/echo/test/out.

example:timer:+:set

#!/bin/bash

# Kill concurrent run of ourselves
echo "KILL $MQTT_TOPIC" >&3

n=$1
while [ $n -ge 0 ]; do
    sleep 1
    echo -e "PUB ${MQTT_TOPIC%*set}tick 0 ${#n}\n$n" >&3
    ((n--))
done

This handler sends a tick every second for n seconds when n is sent to a matching topic. Ticks are sent on the same topic with the last set component replaced by tick.

Note that we introduced the KILL command here. A KILL followed by a topic, will kill all existing running commands that match the provided topic. The current process is never killed, even if the topic matches.

Install

From source:

go get -u github.com/rs/moquette

Using docker (assuming the conf/ directory contains your handlers):

docker run -it --rm -v $(pwd)/conf:/etc/moquette.d poitrus/moquette -broker tcp://<broker_ip>:1883

License

All source code is licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].