Giter VIP home page Giter VIP logo

http-mqtt-brige's Introduction

HTTP to MQTT bridge

A simple HTTP to MQTT bridge, for publishing messages.

Using the image

The image contains a webserver and exposes port 5000 by default. To start the container type:

$ docker run -d -p 5000:5000 heleon19/http-mqtt-bridge

Configure the image by environment variables

By default the http-mqtt-bridge will listen on port 5000 and connect to the localhost MQTT Broker.

Well, the image does not contain a local MQTT broker. Set the following environment variables accordingly to determine your MQTT broker.

  • MQTT_HOST: Set this value to the URL to your MQTT broker, eg. mqtts://example.com
  • MQTT_PORT: Set this value to the port to your MQTT broker, eg. 1883 (optional).
  • MQTT_USERNAME: Set to your username for authentication on your MQTT broker.
  • MQTT_PASSWORD: Set to your password accordingly to your username for authentication.
  • MQTT_CLIENT_ID: Set your client ID (optional).
  • HTTP_PORT: Set this value to change default HTTP port of 5000 (optional).
docker run -d \
    -p 5000:5000 \
    -e MQTT_HOST=mqtt://<mqtt-host> \
    -e MQTT_USERNAME=<username> \
    -e MQTT_PASSWORD=<password> \
    heleon19/http-mqtt-bridge

Publish to a topic

Setup and run the docker image ;-) .

You can use GET or POST requests, paramters can be passed as body or query.

  • topic: Topic of the message.
  • message: The message you want to send.
  • qos: Quality of Service, default 0 (optional).
  • retain: Send message as retain, default false (optional).

Example:

http://<ip-http-mqtt-bridge>:5000/publish?topic=myTopic&message=myMessage

Thanks

This idea goes back to petkov's HTTP to MQTT bridge based on Node JS. Thank you very much for this simple and reliable piece of code! I just modified it!

http-mqtt-brige's People

Contributors

heleon19 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.