Skip to content

fcabestre/Scala-MQTT-client

Repository files navigation

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 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

About

A Scala MQTT client library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages