How to use the webthing.MultipleThings function in webthing

To help you get started, we’ve selected a few webthing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rzr / webthing-iotjs / example / multiple-things.js View on Github external
function runServer() {
  // Create a thing that represents a dimmable light
  const light = new ExampleDimmableLight();

  // Create a thing that represents a humidity sensor
  const sensor = new FakeGpioHumiditySensor();

  // If adding more than one thing, use MultipleThings() with a name.
  // In the single thing case, the thing's name will be broadcast.
  const server = new WebThingServer(new MultipleThings([light, sensor],
                                                       'LightAndTempDevice'),
                                    8888);

  process.on('SIGINT', () => {
    server.stop().then(() => process.exit()).catch(() => process.exit());
  });

  server.start().catch(console.error);
}

webthing

HTTP Web Thing implementation

MPL-2.0
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis