ws-events-and-middlewares
Advanced tools
Comparing version 1.0.15 to 1.0.16
21
index.js
const Emitter = require('component-emitter') | ||
const uuidv4 = require('uuid/v4') | ||
@@ -160,2 +161,6 @@ callbackCounter = 0 | ||
function clients () { | ||
return clients | ||
} | ||
var events = Object.create(sock) | ||
@@ -172,7 +177,19 @@ events.emit = emit | ||
events.toAll = toAll | ||
events.clients = clients | ||
// Guardamos el nuevo cliente | ||
clients[sock.id] = events | ||
// Generamos un id para el socket solo si estamos en el servidor y guardamos el socket como cliente, en el cliente no es necesario | ||
if (typeof module !== 'undefined' && module.exports) { | ||
let found = false | ||
while (!found) { | ||
const id = uuidv4() | ||
if (!clients[id]) { | ||
found = true | ||
events.id = id | ||
clients[id] = events | ||
} | ||
} | ||
} | ||
return events | ||
} |
{ | ||
"name": "ws-events-and-middlewares", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "ws module wrapper to provide events", | ||
@@ -27,4 +27,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"component-emitter": "^1.2.1" | ||
"component-emitter": "^1.2.1", | ||
"uuid": "^3.3.2" | ||
} | ||
} |
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
9577
166
2
+ Addeduuid@^3.3.2
+ Addeduuid@3.4.0(transitive)