Skip to content

Commit

Permalink
examples: add static address
Browse files Browse the repository at this point in the history
  • Loading branch information
egekorkan committed Sep 7, 2023
1 parent 8bdbba0 commit 4fafd4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/examples/src/quickstart/simple-coffee-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// This is an example Thing script which is a simple coffee machine.
// You can order coffee and see the status of the resources

import { Servient } from "@node-wot/core";
import { Servient, Helpers } from "@node-wot/core";
import { HttpServer } from "@node-wot/binding-http";

// create Servient add HTTP binding with port configuration
Expand All @@ -27,6 +27,8 @@ servient.addServer(
})
);

Helpers.setStaticAddress("plugfest.thingweb.io"); // comment this out if you are testing locally

let waterAmount = 100;
let beansAmount = 100;
let milkAmount = 100;
Expand Down
4 changes: 3 additions & 1 deletion packages/examples/src/quickstart/smart-clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

// This is an example Thing which is a smart clock that runs 60 times faster than real time, where 1 hour happens in 1 minute.

import { Servient } from "@node-wot/core";
import { Servient, Helpers } from "@node-wot/core";
import { CoapServer } from "@node-wot/binding-coap";

// create Servient add CoAP binding with port configuration
const servient = new Servient();
servient.addServer(new CoapServer(5685));

Helpers.setStaticAddress("plugfest.thingweb.io"); // comment this out if you are testing locally

let minuteCounter = 0;
let hourCounter = 0;

Expand Down

0 comments on commit 4fafd4a

Please sign in to comment.