Git Product home page Git Product logo

mqtt-broker's Introduction

mqtt-broker

mqtt-broker is a work-in-process MQTT broker. It aims to implement the MQTT protocol version 3.1.1.

mqtt-broker is written in Rust, a systems programming language that emphasizes memory and concurrency safety. In order to build the project, you will need a Rust compiler. The easiest way to get started is to install rustup, a tool that will install the necessary build tools. Once rustup is installed, install the nightly compiler:

$ rustup install nightly
info: syncing channel updates for 'nightly'
info: downloading toolchain manifest
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'rust-docs'
info: downloading component 'cargo'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'rust-docs'
info: installing component 'cargo'

  nightly installed: rustc 1.9.0-nightly (02310fd31 2016-03-19)

You should now be able to build the project by going to the project root and running cargo build. Run the project with cargo run.

Right now, the main() method listens to port 1883 for client connections. I have set up two clients using mqttc, a Rust MQTT client library. The two clients connect to the broker and subscribe to the topic test-topic, and then each publishes a message with QoS 1. The broker then publishes each client's message to the topic, and both clients receive the other's message.

Work done

  • All MQTT broker code was written from scratch. There are no dependencies other than the Rust standard library, crates (Rust packages) for bitflag processing, UUID generation, and random number generation, and mqttc for testing. I wrote code to read from the TCP socket, deserialize packets from clients, and serialize and send packets back to clients.
  • CONNECT, CONNACK, PUBLISH, PUBACK, SUBSCRIBE, SUBACK, PINGREQ, and PINGRESP packets are handled.
  • Some session logic is implemented.
  • QoS 0 and 1 messages are received and published.

Work to be done

  • Handle QoS 2 messages (and PUBREC, PUBREL, and PUBCOMP packets)
  • Handle UNSUBSCRIBE and UNSUBACK
  • Handle DISCONNECT and cleaning up sessions after clients disconnect
  • Client authentication
  • And lots more... the specification is quite broad.

mqtt-broker's People

Watchers

Christopher Fu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.