Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ws-events-and-middlewares

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ws-events-and-middlewares - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

13

index.js

@@ -11,2 +11,3 @@ const Emitter = require('component-emitter')

let rooms = {}
let clients = {}

@@ -17,2 +18,5 @@ module.exports = function wsEvents (sock, middlewares = []) {

// Guardamos el nuevo cliente
clients[sock.id] = sock
async function onmessage (event) {

@@ -79,3 +83,3 @@ var json, args

function onclose (event) {
// TODO: sacamos el cliente
if (clients[sock.id]) delete clients[sock.id]
listeners.emit('close', event)

@@ -156,3 +160,8 @@ }

emit: function () {
const args = Array.from(arguments)
if (!Array.isArray(rooms[room])) { return }
rooms[room].map(socketId => {
console.log('Emitiendo mensaje el socket ' + socketId + 'por estar en la sala ' + room)
clients[socketId].emit.apply(clients[socketId], args)
})
}

@@ -159,0 +168,0 @@ }

2

package.json
{
"name": "ws-events-and-middlewares",
"version": "1.0.8",
"version": "1.0.9",
"description": "ws module wrapper to provide events",

@@ -5,0 +5,0 @@ "main": "index.js",

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