Created
May 28, 2015 08:56
-
-
Save gabrielschulhof/feae6545232e4505e7e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This client differs from the simple client only in that the URL in the request is absolute, | |
// causing it to specifically target the server.observable entity handler. | |
var intervalId, | |
iotivity = require( "iotivity" ), | |
handle = {}; | |
iotivity.OCInit( null, 0, iotivity.OCMode.OC_CLIENT ); | |
intervalId = setInterval( function() { | |
iotivity.OCProcess(); | |
}, 100 ); | |
iotivity.OCDoResource( | |
handle, | |
iotivity.OCMethod.OC_REST_GET, | |
"/a/9dof", | |
null, | |
null, | |
iotivity.OCConnectivityType.OC_ALL, | |
iotivity.OCQualityOfService.OC_HIGH_QOS, | |
function( handle, response ) { | |
console.log( "OCDoResource() handler: Entering" ); | |
console.log( response ); | |
return iotivity.OCStackApplicationResult.OC_STACK_DELETE_TRANSACTION; | |
}, | |
null, | |
0 ); | |
process.on( "SIGINT", function() { | |
console.log( "SIGINT: Quitting..." ); | |
clearInterval( intervalId ); | |
iotivity.OCStop(); | |
process.exit( 0 ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment