New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

homenode-node

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homenode-node - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

7

example.js

@@ -71,2 +71,7 @@ var homenode = require('./homenode.js')(

temp2Device.fireEvent('TempChanged',temp2Device.state);
},6000);
},40100);
// Simulate switch
setInterval(function() {
homenode.getDevice('1234').fireEvent('triggered');
},50000);

22

homenode.js

@@ -36,3 +36,2 @@ var express = require('express');

}
devices.push(device);
device.fireEvent = function(eventName,payload) {

@@ -42,4 +41,5 @@ master.notify(

type : 'event',
event : eventName,
device : device.id,
event : eventName,
state : device.state,
payload : payload

@@ -49,2 +49,5 @@ }

}
devices.push(device);
master.notify( {

@@ -68,7 +71,4 @@ type: 'newdevice',

var executeDeviceAction = function(req,res) {
var idx = getDeviceIndex(req.params.deviceid);
if( idx==-1 ) {
res.sendStatus(404);
} else {
var device = devices[idx];
var device = getDeviceById(req.params.deviceid);
if( device ) {
var action = getDeviceAction(device, req.params.actionname);

@@ -81,5 +81,12 @@ if( action ) {

}
} else {
res.sendStatus(404);
}
}
function getDeviceById(id) {
var idx = getDeviceIndex(id);
return (idx==-1 ? null : devices[idx]);
}
function removeDevice(id) {

@@ -174,4 +181,5 @@ var idx=getDeviceIndex(id);

addDevice : addDevice,
getDevice : getDeviceById,
removeDevice : removeDevice
}
}

@@ -122,12 +122,7 @@ /**

module.exports.notify = function(data) {
var payload = {
type : data.type,
nodeid : local.id,
device : data.device,
event : data.event,
payload : data.payload,
}
var postData = JSON.stringify(payload);
data.node = local.id;
var postData = JSON.stringify(data);
masterNodes.forEach( function(masternode) {

@@ -138,3 +133,3 @@ if(masternode.registered) {

var connectionData = urlHelper.parse(notifyUrl,true);
obj(connectionData);
//obj(connectionData);
var options = {

@@ -149,11 +144,4 @@ hostname: connectionData.hostname,

log('STATUS: ' + res.statusCode);
log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
var data = '';
res.on('data', function (chunk) {
log('PARTIAL BODY: ' + chunk);
data += chunk;
});
res.on('end', function() {
log('COMPLETE BODY: ' + data);
//log('COMPLETE BODY: ' + data);
});

@@ -160,0 +148,0 @@ req.on('error', function(e) {

{
"name": "homenode-node",
"version": "0.0.7",
"version": "0.0.8",
"description": "Homenode node library",

@@ -11,3 +11,3 @@ "main": "homenode.js",

"express": "^4.12.4",
"node-express-yourself": "0.0.4",
"node-express-yourself": "0.0.5",
"node-ssdp": "^2.7.2"

@@ -14,0 +14,0 @@ },

@@ -7,2 +7,3 @@ var log = require('./log.js')('ssdp');

var client = new SSDP({
// unicastHost: '192.168.11.63'

@@ -24,2 +25,3 @@ });

log("Searching for master ...");
//client.search('ssdp:all');
}

@@ -26,0 +28,0 @@ setInterval(search, 10000);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc