Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

client.findResources() is failing to discover the resources #33

Closed
nagineni opened this issue Nov 11, 2015 · 1 comment
Closed

client.findResources() is failing to discover the resources #33

nagineni opened this issue Nov 11, 2015 · 1 comment
Labels

Comments

@nagineni
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant