Scala-MQTT-client


License

License

Categories

Categories

Scala Languages Net CLI User Interface
GroupId

GroupId

net.sigusr
ArtifactId

ArtifactId

scala-mqtt-client_2.11
Last Version

Last Version

0.6.0
Release Date

Release Date

Type

Type

jar
Description

Description

Scala-MQTT-client
Scala-MQTT-client
Project URL

Project URL

https://github.com/fcabestre/Scala-MQTT-client
Project Organization

Project Organization

net.sigusr
Source Code Management

Source Code Management

https://github.com/fcabestre/Scala-MQTT-client

Download scala-mqtt-client_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/net.sigusr/scala-mqtt-client_2.11/ -->
<dependency>
    <groupId>net.sigusr</groupId>
    <artifactId>scala-mqtt-client_2.11</artifactId>
    <version>0.6.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.sigusr/scala-mqtt-client_2.11/
implementation 'net.sigusr:scala-mqtt-client_2.11:0.6.0'
// https://jarcasting.com/artifacts/net.sigusr/scala-mqtt-client_2.11/
implementation ("net.sigusr:scala-mqtt-client_2.11:0.6.0")
'net.sigusr:scala-mqtt-client_2.11:jar:0.6.0'
<dependency org="net.sigusr" name="scala-mqtt-client_2.11" rev="0.6.0">
  <artifact name="scala-mqtt-client_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.sigusr', module='scala-mqtt-client_2.11', version='0.6.0')
)
libraryDependencies += "net.sigusr" % "scala-mqtt-client_2.11" % "0.6.0"
[net.sigusr/scala-mqtt-client_2.11 "0.6.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.6
com.typesafe.akka : akka-actor_2.11 jar 2.3.9
com.typesafe.akka : akka-testkit_2.11 jar 2.3.9
org.scodec : scodec-core_2.11 jar 1.7.1
org.scalaz : scalaz-core_2.11 jar 7.1.1

provided (2)

Group / Artifact Type Version
org.scoverage : scalac-scoverage-runtime_2.11 jar 1.0.1
org.scoverage : scalac-scoverage-plugin_2.11 jar 1.0.1

test (1)

Group / Artifact Type Version
org.specs2 : specs2_2.11 jar 2.4.15

Project Modules

There are no modules declared in this project.

A Scala MQTT client library Build Status Coverage Status

In the beginning...

I wanted to build a presentation of Akka. But not just a deck of slides, I wanted something to live-code with, something backed by real hardware. Maybe a Raspberry Pi. I imagined the small devices sending messages to an MQTT broker, probably Mosquitto.

To this purpose, I looked for an MQTT library which I could use with Scala, but those I found were only Java based. I thought: "Could be fun to implement the MQTT protocol directly with Akka IO. Its specification is rather short (around 42 printed pages)".

And quickly, when I came to look at how to encode/decode MQTT protocol frames, I stumbled upon Scodec. This seemed to be the encoding/decoding framework I was waiting for a long time. So I decided to give it a try...

And now

I have a basic and far from complete implementation of the thing. Frame encoding and decoding works pretty well, and it's possible to write some code to talk to Mosquitto. For examples you can have a look to the [local subscriber] (https://github.com/fcabestre/Scala-MQTT-client/blob/master/examples/src/main/scala/net/sigusr/mqtt/examples/LocalSubscriber.scala) or the local publisher. I'm starting to take it a bit more seriously. I mean, thinking of doing something that could be useful to others. But there is still a lot of work to be done:

  • Learning how other MQTT APIs are organised to polish this one
  • Managing communication back pressure with Akka IO
  • Suppoting both MQTT v3.1 and v3.1.1
  • If I dare, passing Paho conformance tests
  • And many, many, many more I can't foresee...

Releases

Artifacts are available at Sonatype OSS Repository Hosting service, even the SNAPSHOTS automatically built by Travis CI. To include the Sonatype repositories in your SBT build you should add,

resolvers ++= Seq(
    Resolver.sonatypeRepo("releases"),
    Resolver.sonatypeRepo("snapshots")
)

In case you want to easily give a try to this library, without the burden of adding resolvers, there is a release synced to Maven Central. In this case just add,

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
    "net.sigusr" %% "scala-mqtt-client" % "0.6.0"
)

Moreover, since version 0.7.0-SNAPSHOT, there is a cross built set up for Scala 2.11 and 2.12.

Dependencies

Roughly speaking this library depends on Scala, Akka (core and soon I hope streams), Scodec core and Scalaz.

License

This work is licenced under an Apache Version 2.0 license

Versions

Version
0.6.0
0.5.0