Push Test with MQTT

Here you can easily test pushing data to browsers with Fanout. This page uses MQTT.js.

Initializing...

Subcribing and Publishing

This page is using the following JavaScript to subscribe to events:

// token limited to read/write of "test" topic
const token = "205124e8e4b1933e780226c95fb0bd0091965a03";

const client = mqtt.connect("wss://mqtt-poc.edgecompute.app/mqtt", {
  reconnectPeriod: 0,
  protocolVersion: 5,
  username: "",
  password: token
});

client.on("connect", () => {
  client.subscribe("test", (err) => {
    if (!err) {
      console.log("subscribed");
    }
  });
});

client.on("message", (topic, message) => {
  // message is Buffer
  $('#output').text(message.toString());
});