Coder Social home page Coder Social logo

http2mqtt's Introduction

http2mqtt

This is simple as possible!

  • Starts a webserver
  • Pass the topic, payload, username, password in request body by json format
  • Try to connect to the MQTT Broker when request format is right
  • Works only with POST method
  • Supports MQTT with tls
  • The http api uses basic auth

How to use

Run

Clone the repo, add your cert as ./crt.ca.cg.pem, edit your broker url, http port, broker port, api username, api password in index.js.

Use DOCKERFILE to build the image:

docker build -t http2mqtt .

Run the docker image in docker-compose:

docker compose up -d

Also you can run the docker image in command line:

docker run -it -d -p 127.0.0.1:8080:8080 http2mqtt --restart unless-stopped

Test

Target Url:

localhost:[port]

Don't forget basic auth {username='xxx', password='xxx'} (you must pass this auth to use this http API) and request body, you should set MQTT topic, MQTT payload, MQTT username, MQTT password in json:

{
    "topic": "test-topic",
    "payload": "test-payload",
    "username": "test-username",
    "password": "test-password"
}

If you come with something wrong, you will get corresponding error message in the response, if you success to send a MQTT message, you will get success info in the response.

http2mqtt's People

Watchers

Robin Chen 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.