Follow Us

Kuzzle for IoT Apps

Integrate IoT with Web & Mobile on one backend

Kuzzle natively supports standard IoT protocols like HTTP, WebSockets and MQTT, but can be extended to include any other TCP/UDP protocol thanks to its powerful plugin engine. With a database, pub/sub real-time engine, advanced search, geofencing, SDKs & Admin Console, our solution has everything an IoT application needs.

Case Study


Kuzzle tracks a set of connected bikes and sends notifications when the bikes enter or exit a specified geographical area.

Read the complete case study

Developers' corner - MQTT example

  • Javascript
  • Android
  • GO
  • function communicate() {    
    //Get the mqtt module var mqtt = require('mqtt'); //Connect to Kuzzle client = mqtt.connect({host: 'localhost'}); client.on('connect', function() { //Once connected publish a message client.publish('Kuzzle/request', JSON.stringify({ index: 'myindex', collection: 'mycollection', controller: 'real-time', action: 'publish', requestId: 'unique_request_id', body: {volatile: 'message'} })); }); // Listen for the Kuzzle response client.on('message', function(topic, raw){ // Parse the message var message = JSON.parse(new Buffer(raw)); // If this is a Kuzzle response check the requestId if (topic === 'Kuzzle/response') { // Check if the requestId is the the same as for the request we sent if (message.requestId === 'unique_request_id') { console.log('Received Response: ', message); doSomething(message); } } });
  • public void communicate() {    
    //Create the mqtt client MqttClient client = new MqttClient( "tcp://localhost:1883", //URI MqttClient.generateClientId(), //ClientId new MemoryPersistence()); //Persistence //Connect to Kuzzle client.connect(); // Listen for the Kuzzle response client.setCallback(new MqttCallback() { @Override public void connectionLost(Throwable cause) { } @Override public void messageArrived(String topic, MqttMessage message) throws Exception { //Get the Kuzzle response String payload = new String(message.getPayload()); System.out.println(topic + ": " + payload); doSomething(payload); } @Override public void deliveryComplete(IMqttDeliveryToken token) { } }); //Subscribe to the Kuzzle/response topic client.subscribe("Kuzzle/response", 1); //Publish a message to Kuzzle JSONObject body = new JSONObject() .put("volatile", "message"); JSONObject payload = new JSONObject() .put("index", "myindex") .put("collection", "mycollection") .put("controller", "real-time") .put("action", "publish") .put("requestId", "unique_request_id") .put("body", body); client.publish( "Kuzzle/request", // topic payload.toString().getBytes("UTF-8"), // payload 2, // QoS false);
  • func communicate() {    
    //Connect to Kuzzle opts := mqtt.NewClientOptions().AddBroker("tcp://localhost:1883") client := mqtt.NewClient(opts) if token := client.Connect(); token.Wait() && token.Error() != nil { handleError(token.Error()) } var wg sync.WaitGroup wg.Add(1) //Subscribe to the Kuzzle/response topic if token := client.Subscribe("Kuzzle/response", 0, func(client mqtt.Client, msg mqtt.Message) { if string(msg.Payload()) != "mymessage" { handleError("unexpected result") } //Get the Kuzzle response doSomething(string(msg.Payload())) wg.Done() }); token.Wait() && token.Error() != nil { handleError(token.Error()) } //Publish a message to Kuzzle payload := []byte(`{"index": "myindex", "collection": "mycollection", "controller": "real-time", "action": "publish", "requestId": "unique_request_id", "body": {"volatile": "message"}}`) if token := client.Publish("Kuzzle/request", 0, false, payload); token.Wait() && token.Error() != nil { handleError(token.Error()) } wg.Wait()

They Trust us