• This repository has been archived on 24/Oct/2022
  • Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    Elixir
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED : An Elixir library (driver) for clients communicating with MQTT brokers(via the MQTT 3.1.1 protocol).

DEPRECATED : Hulaaki (हुलाकी)

Further DEVELOPMENT of this library has now been STOPPED. Please consider looking into other alternatives. (such as tortoise)

Build Status Coverage Status Hex.pm Project Inline docs

An Elixir library (driver) for clients communicating with MQTT brokers(via the MQTT 3.1.1 protocol).

A quick tour of the features implemented right now:

  • Qos 0 and Qos 1 support available. QoS 2 not supported yet.
  • SSL/TLS support available.
  • Automatic Ping based on keep alive timeout.
  • Internal packet id generation for control packets with variable header.

Naming

Hulaaki(pronouced as who-laa-key) is the phonetic spelling of the word हुलाकी in Nepali, which translates to postman.

Usage

Before we get started, keep in mind that you need a running MQTT server that you can connect to.

Add Hulaaki to your project dependencies in mix.exs

def deps do
  [{:hulaaki, "~> 0.1.2"} ]
end

The quickest way to get up and running with Hulaaki is to use the provided Client module. This Genserver module defines function callbacks that are intended to be overridden for required implementations. The callbacks are defined for each MQTT message that is being sent and received from the server.

Here's a list of all the override-able callbacks touse in your projects.

An example is present below that overrides some callbacks.

defmodule SampleClient do
  use Hulaaki.Client

  def on_connect_ack(options) do
    IO.inspect options
  end

  def on_subscribed_publish(options) do
    IO.inspect options
  end

  def on_subscribe_ack(options) do
    IO.inspect options
  end

  def on_ping_response(options) do
    IO.inspect options
  end
end

Load the project in iex -S mix to explore the SampleClient

$ iex -S mix

> {:ok, pid} = SampleClient.start_link(%{})

> options = [client_id: "some-name-7490", host: "localhost", port: 8883, ssl: true]

> SampleClient.connect(pid, options)

> SampleClient.ping(pid)

Please check the inline documentation and client_tcp_test.exs for more example usage and test strategy.

Changelog

Please check the CHANGELOG.md.

Documentation

Please refer to the inline documentation and client tests to explore the documentation for now.

Contributing

Pull requests with appropriate tests and improvements are welcome. Mosquitto is currently used by the author to test the library.

Running the tests

If you already have Elixir runtime and a MQTT broker running (on standard ports), you should just be able to run mix test as you would do on other mix projects.

As prefered by the author, you can also use the provided Makefile to run the tests. In that case, you'll need the following on your machine

  • GNU Make ( Version 4.0 and up )
  • Docker Engine ( Version 17.06.1 and hopefully upwards )
  • Docker Compose ( Version 1.16.1 and hopefully upwards )
# Get help
$ make help

# Start the MQTT servers (better to start separately to warm them up)
$ make start

# Run tests
$ make test

# Stop and cleanup docker instances etc.
# make stop

More Repositories

1

one-time

One Time Password (TOTP and HOTP) library for Clojure. TOTP/HOTP is widely used for Two Factor / Multi Factor Authentication.
Clojure
163
star
2

nepalify

A JavaScript library that adds support for typing Unicode Nepali(नेपाली) input on HTML <input> and <textarea>. (both in romanized and traditional layout)
JavaScript
48
star
3

nepali-romanized-pro

Nepali Romanized Keyboard Layout with installer for macOS
Makefile
34
star
4

nixos-nvidia-cuda-python-docker-compose

A step-by-step guide to setting up Nvidia GPUs with CUDA support running on Docker (and Compose) containers on NixOS host
Dockerfile
30
star
5

lakh-crore-numbers

A collection(Python, Rust) of libraries for formatting numbers into the "Lakh Crore" (...हजार, लाख, करोड, अर्ब...) system.
Rust
6
star
6

jaxember-21

Jupyter Notebook
4
star
7

alpa

अल्प — वि॰ [सं॰] १. थोरै; अलिकति; कम्ती । २. सानो; छोटो ।
Rust
2
star
8

taxophoney

GPT (Decoder only Transformer - from scratch) generated fake/phoney taxonomies (based on NCBI taxonomy dataset)
Jupyter Notebook
2
star
9

nnze2he

Following along https://github.com/karpathy/nn-zero-to-hero/
Jupyter Notebook
1
star
10

ugradish

Following along the building micrograd walkthrough - Multilayers Perceptrons from scratch
Jupyter Notebook
1
star
11

very-basic-gradio-api-app

1
star
12

fastnotes

Note(book)s related to fast.ai courses and the book
Jupyter Notebook
1
star
13

nand2tetris

Following along the https://www.nand2tetris.org/
Assembly
1
star