Giter VIP home page Giter VIP logo

esp8266mqttclient's Introduction

MQTT Client library for ESP8266 Arduino

This is MQTT client library for ESP8266, using mqtt_msg package from MQTT client library for Contiki and use for ESP8266 NON-OS SDK esp_mqtt

Features:

  • Support subscribing, publishing, authentication, will messages, keep alive pings and all 3 QoS levels (it should be a fully functional client).

Requirements

  • ESP8266WiFi
  • WiFiClientSecure

Status

  • Support 3 type of qos (0, 1, 2) and outbox
  • only mqtt over TCP

MQTT URI Scheme

  • mqtt://[username][:password@]hostname[:port][#clientId]
    • mqtt for MQTT over TCP
    • ws for MQTT over Websocket
  • Example:
    • Full mqtt://username:[email protected]:1883#my_client_id
    • Websocket ws://username:[email protected]:1883/mqtt#my_client_id
    • Minimal mqtt://test.mosquitto.org, with user, pass = NULL, port = 1883, client id = "ESP_" + ESP.getChipId()

API

Setup

  • bool begin(String uri);
  • bool begin(String uri, int keepalive, bool clean_session);
  • bool begin(String uri, LwtOptions lwt);
  • bool begin(String uri, LwtOptions lwt, int keepalive, bool clean_session)

Events

  • void onConnect(THandlerFunction fn);
  • void onDisconnect(THandlerFunction fn);
  • void onSubscribe(THandlerFunction_PubSub fn);
  • void onPublish(THandlerFunction_PubSub fn);
  • void onData(THandlerFunction_Data fn);

Pub/Sub

  • int subscribe(String topic);
  • int subscribe(String topic, uint8_t qos);
  • int publish(String topic, String data);
  • int publish(String topic, String data, int qos, int retain);

License

Copyright (c) 2016 Tuan PM (https://twitter.com/tuanpmt) ESP8266 port (c) 2016 Ivan Grokhotkov ([email protected])

License Apache License

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.