Popularity
7.3
Declining
Activity
1.3
Growing
117
9
25

Monthly Downloads: 1,732
Programming language: Elixir
License: MIT License
Tags: Queue    
Latest version: v0.1.2

hulaaki alternatives and similar packages

Based on the "Queue" category

Do you think we are missing an alternative of hulaaki or a related project?

Add another 'Queue' Package

README

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 to](lib/hulaaki/client.ex#L292-L318)use 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](test/hulaaki/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