File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,10 +33,11 @@ const { CoapClientFactory } = require("@node-wot/binding-coap");
3333const servient = new Servient ();
3434servient .addClientFactory (new CoapClientFactory ());
3535
36- WoT .requestThingDescription (" coap://plugfest.thingweb.io:5683/testthing" )
37- .then (async (td ) => {
36+ servient
37+ .start ()
38+ .then (async (WoT ) => {
3839 try {
39- const WoT = await servient . start ( );
40+ const td = await WoT . requestThingDescription ( " coap://plugfest.thingweb.io:5683/testthing " );
4041 const thing = await WoT .consume (td);
4142
4243 // read property
@@ -47,7 +48,7 @@ WoT.requestThingDescription("coap://plugfest.thingweb.io:5683/testthing")
4748 }
4849 })
4950 .catch ((err ) => {
50- console .error (" Fetch error:" , err);
51+ console .error (" Start error:" , err);
5152 });
5253```
5354
Original file line number Diff line number Diff line change @@ -33,10 +33,11 @@ HttpClientFactory = require("@node-wot/binding-http").HttpClientFactory;
3333let servient = new Servient ();
3434servient .addClientFactory (new HttpClientFactory (null ));
3535
36- WoT .requestThingDescription (" http://plugfest.thingweb.io:8083/testthing" )
37- .then (async (td ) => {
36+ servient
37+ .start ()
38+ .then (async (WoT ) => {
3839 try {
39- const WoT = await servient . start ( );
40+ const td = await WoT . requestThingDescription ( " http://plugfest.thingweb.io:8083/testthing " );
4041 const thing = await WoT .consume (td);
4142
4243 // read property
@@ -47,7 +48,7 @@ WoT.requestThingDescription("http://plugfest.thingweb.io:8083/testthing")
4748 }
4849 })
4950 .catch ((err ) => {
50- console .error (" Fetch error:" , err);
51+ console .error (" Start error:" , err);
5152 });
5253```
5354
You can’t perform that action at this time.
0 commit comments