23 Matching Annotations
  1. Jul 2023
    1. WebSocket support in Pub/Sub works by encapsulating MQTT packets (Pub/Sub’s underlying native protocol) within WebSocket framesExternal link icon

      ```js // Ensure MQTT.js is installed first // > npm install mqtt import * as mqtt from "mqtt"

      // Where 'url' is "mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:8884" function example(url) { let client = mqtt.connect(url, { protocolVersion: 5, reconnectPeriod: 0, username: 'anything', password: jwt, // pass this from a form field in your app clientId: '', })

      client.on('connect', function () { client.subscribe(topic, function (err) { if (err) { client.end(); } else { console.log(subscribed to ${topic}) } })

      client.on('message', function (topic, message) { let line = (new Date()).toLocaleString('en-US') + ": " + message.toString() + "\n"; console.log(line) }) } ```

  2. Mar 2022
    1. dt/<application>/<context>/<thing-name>/<dt-type>

      Suggested topic structure

    2. Prefix your MQTT topics to distinguish data topics from command topics

      What if topic prefixed by device first? is device-1/{cmd|data)?

  3. Feb 2022
  4. Jun 2020
    1. MQTT

      Message Queuing Telemetry Transport MQTT protocol -> publish-subscribe network protocol that transports messages between devices, usually through TCP/IP

      Protocol defines 2 network entities:

      1. message broker -> receives messages from clients and then sends them to any clients subscribed to topic.
      2. a number of clients ->
      <table style="border: 1px solid black;"> <tr> <th style="border: 1px solid black;"> MQTT un-encrypted port </th> <th style="border: 1px solid black;"> MQTT encrypted port </th> </tr> <tr> <td style="border: 1px solid black;">**1883** </td> <td style="border: 1px solid black;">**8883** </td> </tr> </table>
  5. Jul 2017
    1. Everything you need to know about MQTTWe wrote this series to bring anybody up to speed with MQTT without requiring to read the whole MQTT specification. It explains the core of MQTT concepts, its features and other essential information.
  6. Jun 2017