Skip to content

Instantly share code, notes, and snippets.

@jacksonkeating
Last active May 21, 2024 15:56
Show Gist options
  • Save jacksonkeating/41f55496aa715eabd70d179cb669294d to your computer and use it in GitHub Desktop.
Save jacksonkeating/41f55496aa715eabd70d179cb669294d to your computer and use it in GitHub Desktop.
//prototypes
//functions without a host argument use unauthenticated mqtt://test.mosquitto.org:1883 by default
async function expect(topic);
async function publish(topic, publishValue);
async function expectCustom(host, username, password, topic, publishValue);
async function publishCustom(host, username, password, topic, publishValue);
//examples
var result: {status: string, data: Uint8Array } = {}
await wavecake.mqtt.expect('wavecake');
await wavecake.mqtt.publish('wavecake', 'String');
await wavecake.mqtt.expectCustom('mqtts://test.mosquitto.org:8883','wavecake_dev','password','wavecake');
await wavecake.mqtt.publishCustom('mqtts://test.mosquitto.org:8883','wavecake_dev','password','wavecake','String');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment