Comparing version 0.1.5 to 0.1.6
34
index.js
@@ -58,11 +58,25 @@ 'use strict' | ||
var updateOtherSockets = function () { | ||
for (let socket of io.sockets.sockets) { | ||
var newEventList = _.difference(config.events, keyNameToArray(socket._events)) | ||
newEventList = _.difference(newEventList, defaultSocketEvent) | ||
for (let triggerName of newEventList) { | ||
socket.on(triggerName, function (datas) { | ||
console.log('index.js - registered event: ' + triggerName + ' triggered with datas: ', datas) | ||
io.emit(triggerName, datas) | ||
}) | ||
if (Array.isArray(io.sockets.sockets)) { | ||
for (let socket of io.sockets.sockets) { | ||
var newEventList = _.difference(config.events, keyNameToArray(socket._events)) | ||
newEventList = _.difference(newEventList, defaultSocketEvent) | ||
for (let triggerName of newEventList) { | ||
socket.on(triggerName, function (datas) { | ||
console.log('index.js - registered event: ' + triggerName + ' triggered with datas: ', datas) | ||
io.emit(triggerName, datas) | ||
}) | ||
} | ||
} | ||
} else { | ||
let socket = io.sockets.sockets[Object.keys(io.sockets.sockets)[0]] | ||
if (socket && socket.clientName && socket.eventsListRegistered) { | ||
var newEventList = _.difference(config.events, keyNameToArray(socket._events)) | ||
newEventList = _.difference(newEventList, defaultSocketEvent) | ||
for (let triggerName of newEventList) { | ||
socket.on(triggerName, function (datas) { | ||
console.log('index.js - registered event: ' + triggerName + ' triggered with datas: ', datas) | ||
io.emit(triggerName, datas) | ||
}) | ||
} | ||
} | ||
} | ||
@@ -89,3 +103,3 @@ } | ||
for (let socket of io.sockets.sockets) { | ||
if (socket.clientName && socket.eventsListRegistered) { | ||
if (socket && socket.clientName && socket.eventsListRegistered) { | ||
table.push([socket.clientName, socket.eventsListRegistered, socket.connected ? 'online' : 'offline']) | ||
@@ -96,3 +110,3 @@ } | ||
let socket = io.sockets.sockets[Object.keys(io.sockets.sockets)[0]] | ||
if (socket.clientName && socket.eventsListRegistered) { | ||
if (socket && socket.clientName && socket.eventsListRegistered) { | ||
table.push([socket.clientName, socket.eventsListRegistered, socket.connected ? 'online' : 'offline']) | ||
@@ -99,0 +113,0 @@ } |
{ | ||
"name": "spacebro", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Spacebro use Zeroconf and socket.io to bind apps together!", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3410013
142