File tree Expand file tree Collapse file tree
packages/examples/src/bindings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,10 +20,11 @@ import { CoapClientFactory } from "@node-wot/binding-coap";
2020const servient = new Servient ( ) ;
2121servient . addClientFactory ( new CoapClientFactory ( ) ) ;
2222
23- WoT . requestThingDescription ( "coap://plugfest.thingweb.io:5683/testthing" )
24- . then ( async ( td ) => {
23+ servient
24+ . start ( )
25+ . then ( async ( WoT ) => {
2526 try {
26- const WoT = await servient . start ( ) ;
27+ const td = await WoT . requestThingDescription ( "coap://plugfest.thingweb.io:5683/testthing" ) ;
2728 const thing = await WoT . consume ( td ) ;
2829
2930 // read property
@@ -34,5 +35,5 @@ WoT.requestThingDescription("coap://plugfest.thingweb.io:5683/testthing")
3435 }
3536 } )
3637 . catch ( ( err ) => {
37- console . error ( "Fetch error:" , err ) ;
38+ console . error ( "Start error:" , err ) ;
3839 } ) ;
Original file line number Diff line number Diff line change @@ -20,10 +20,11 @@ import { HttpClientFactory } from "@node-wot/binding-http";
2020const servient = new Servient ( ) ;
2121servient . addClientFactory ( new HttpClientFactory ( ) ) ;
2222
23- WoT . requestThingDescription ( "http://plugfest.thingweb.io:8083/testthing" )
24- . then ( async ( td ) => {
23+ servient
24+ . start ( )
25+ . then ( async ( WoT ) => {
2526 try {
26- const WoT = await servient . start ( ) ;
27+ const td = await WoT . requestThingDescription ( "http://plugfest.thingweb.io:8083/testthing" ) ;
2728 const thing = await WoT . consume ( td ) ;
2829
2930 // read property
@@ -34,5 +35,5 @@ WoT.requestThingDescription("http://plugfest.thingweb.io:8083/testthing")
3435 }
3536 } )
3637 . catch ( ( err ) => {
37- console . error ( "Fetch error:" , err ) ;
38+ console . error ( "Start error:" , err ) ;
3839 } ) ;
You can’t perform that action at this time.
0 commit comments