xamarin / mqtt

Minimalist and intuitive MQTT broker and client written entirely in C#
http://xamarin.github.io/mqtt
MIT License
302 stars 72 forks source link

Introduction

Code name: Hermes (messenger of the Greek gods)

Build Status Client Downloads Server Downloads

MQTT is a Client Server publish/subscribe messaging transport protocol, designed to be lightweight, open and simple to use and implement. This makes it suitable for Internet of Things (IoT) messaging, machine to machine communication, mobile devices, etc.

System.Net.Mqtt is a lightweight and simple implementation of the MQTT protocol version 3.1.1, written entirely in C# and divided in two libraries: System.Net.Mqtt and System.Net.Mqtt.Server.

The foundation of the System.Net.Mqtt libraries is to provide an intuitive and very easy to use API, hiding most of the protocol concepts that don't need to be exposed, letting consumers just focus on the main protocol operations, which are: CONNECT, SUBSCRIBE, UNSUBSCRIBE, PUBLISH, DISCONNECT.

All the protocol packets acknowledgement happens under the hood in an asynchronous way, adding a level of simplicity reduced to just awaiting the client method calls in a native .net style without worring about low level protocol concepts.

Also, the reception of the subscribed messages is handled using an IObservable implementation, which makes the stream of messages to receive more natural and aligned to the concept of Publish/Subscribe on which the protocol already relies. Finally, this allows subscribers of the received messages to query and filter them using Reactive Extensions, which adds an extra level of flexibility and control over the messages processing.

Usage samples

Installing

System.Net.Mqtt and System.Net.Mqtt.Server are distributed as [NuGet][1] packages and can be installed from Visual Studio by searching for the "System.Net.Mqtt" packages or by running the following commands from the Package Manager Console:

Client Package: Install-Package System.Net.Mqtt -Pre

Server Package: Install-Package System.Net.Mqtt.Server -Pre

Current package dependencies:

System.Diagnostics.Tracer (>= 2.0.4) System.Net.Sockets (>= 4.1.0) System.Reactive (>= 3.0.0) System.Runtime.Serialization.Primitives (>= 4.1.1)

More

For more specific information about the MQTT protocol, please see the latest Oasis spec.