Closed nagineni closed 9 years ago
Step1: Run client which calles client.findResources() periodically.
var device = require( "iotivity-node" )(); device.configure( { role: "client", connectionMode: "acked" } ).then( function() { discoverResources(); }, function( error ) { console.log( "Client: device.configure() failed with " + error ); } ); device.client.addEventListener( "resourcefound", function( event ) { console.log( "Discovered resource(s) via the following event:\n" + JSON.stringify( event, null, 4 ) ); } ); function discoverResources() { device.client.findResources().then( function() { console.log( "Client: findResources() successful" ); }, function( error ) { console.log( "Client: findResources() failed with " + error + " and result " + error.result ); } ); notifyObserversTimeoutId = setTimeout(discoverResources, 5000); }
Step2: Run the server without resource registration.
var device = require( "iotivity-node" )(); device.configure( { role: "server", connectionMode: "acked", info: { uuid: "Test Server", name: "server-example", manufacturerName: "Intel", firmwareVersion: "0.0.1", } } );
Step 3(optional): Run an another server that register the resource. e.g. https://github.com/otcshare/iotivity-node/blob/master/js/high-level-server-example.js
Outcome: Check the output at client side
Client: findResources() failed with Error: findResources: failed to cancel previous handle and result 255
@gabrielschulhof
Step1: Run client which calles client.findResources() periodically.
Step2: Run the server without resource registration.
Step 3(optional): Run an another server that register the resource. e.g. https://github.com/otcshare/iotivity-node/blob/master/js/high-level-server-example.js
Outcome: Check the output at client side
Client: findResources() failed with Error: findResources: failed to cancel previous handle and result 255