From 4fafd4a23e3692965bb49d0d0aeefc0e3e5012e3 Mon Sep 17 00:00:00 2001 From: Ege Korkan Date: Thu, 7 Sep 2023 23:59:42 +0300 Subject: [PATCH 1/2] examples: add static address --- packages/examples/src/quickstart/simple-coffee-machine.ts | 4 +++- packages/examples/src/quickstart/smart-clock.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/examples/src/quickstart/simple-coffee-machine.ts b/packages/examples/src/quickstart/simple-coffee-machine.ts index 88c1196f8..6c39616f9 100644 --- a/packages/examples/src/quickstart/simple-coffee-machine.ts +++ b/packages/examples/src/quickstart/simple-coffee-machine.ts @@ -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 @@ -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; diff --git a/packages/examples/src/quickstart/smart-clock.ts b/packages/examples/src/quickstart/smart-clock.ts index 4ed040deb..0444ecb50 100644 --- a/packages/examples/src/quickstart/smart-clock.ts +++ b/packages/examples/src/quickstart/smart-clock.ts @@ -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; From b61c90f7434ec1ed107ff7be5c41bd05f93c3999 Mon Sep 17 00:00:00 2001 From: Ege Korkan Date: Fri, 8 Sep 2023 00:03:42 +0300 Subject: [PATCH 2/2] examples: copy to root --- examples/quickstart/simple-coffee-machine.js | 1 + examples/quickstart/smart-clock.js | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/quickstart/simple-coffee-machine.js b/examples/quickstart/simple-coffee-machine.js index a248afe63..59c39781b 100644 --- a/examples/quickstart/simple-coffee-machine.js +++ b/examples/quickstart/simple-coffee-machine.js @@ -24,6 +24,7 @@ servient.addServer( port: 8081, }) ); +core_1.Helpers.setStaticAddress("plugfest.thingweb.io"); // comment this out if you are testing locally let waterAmount = 100; let beansAmount = 100; let milkAmount = 100; diff --git a/examples/quickstart/smart-clock.js b/examples/quickstart/smart-clock.js index 3478e0029..8c71c0f9c 100644 --- a/examples/quickstart/smart-clock.js +++ b/examples/quickstart/smart-clock.js @@ -19,6 +19,7 @@ const binding_coap_1 = require("@node-wot/binding-coap"); // create Servient add CoAP binding with port configuration const servient = new core_1.Servient(); servient.addServer(new binding_coap_1.CoapServer(5685)); +core_1.Helpers.setStaticAddress("plugfest.thingweb.io"); // comment this out if you are testing locally let minuteCounter = 0; let hourCounter = 0; async function timeCount(thing) {