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

node-multi-socketservers

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-multi-socketservers - npm Package Compare versions

Comparing version 0.2.10 to 0.2.11

58

lib/main.js

@@ -176,3 +176,3 @@ "use strict";

emit (eventName, data) {
emit (eventName, ...data) {

@@ -200,7 +200,20 @@ return Promise.resolve().then(() => {

if ("undefined" !== typeof data) {
if ("undefined" === typeof data) {
server.sockets.emit(eventName);
}
else if (!(data instanceof Array)) {
server.sockets.emit(eventName, data);
}
else if (1 === data.length) {
if ("undefined" === typeof data[0]) {
server.sockets.emit(eventName);
}
else {
server.sockets.emit(eventName, data[0]);
}
}
else {
server.sockets.emit(eventName);
server.sockets.emit(eventName, ...data);
}

@@ -218,3 +231,3 @@

broadcast (socket, server, eventName, data) {
broadcast (socket, server, eventName, ...data) {

@@ -254,17 +267,46 @@ return Promise.resolve().then(() => {

// other server
if (_server.options.port !== server.options.port) {
if ("undefined" !== typeof data) {
if ("undefined" === typeof data) {
_server.sockets.emit(eventName);
}
else if (!(data instanceof Array)) {
_server.sockets.emit(eventName, data);
}
else if (1 === data.length) {
if ("undefined" === typeof data[0]) {
_server.sockets.emit(eventName);
}
else {
_server.sockets.emit(eventName, data[0]);
}
}
else {
_server.sockets.emit(eventName);
_server.sockets.emit(eventName, ...data);
}
}
else if ("undefined" !== typeof data) {
// same server
else if ("undefined" === typeof data) {
socket.broadcast.emit(eventName);
}
else if (!(data instanceof Array)) {
socket.broadcast.emit(eventName, data);
}
else if (1 === data.length) {
if ("undefined" === typeof data[0]) {
socket.broadcast.emit(eventName);
}
else {
socket.broadcast.emit(eventName, data[0]);
}
}
else {
socket.broadcast.emit(eventName);
socket.broadcast.emit(eventName, ...data);
}

@@ -271,0 +313,0 @@

2

package.json
{
"name": "node-multi-socketservers",
"version": "0.2.10",
"version": "0.2.11",
"description": "A multi http & socket servers manager, based on node-multi-webserver",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -773,8 +773,8 @@ /*

multiServers.broadcast(socket, server, "testwithdata", false).then(() => {
return multiServers.broadcast(socket, server, "answer").then(() => {
socket.disconnect();
});
multiServers.broadcast(socket, server, "testwithonedata", false).then(() => {
return multiServers.broadcast(socket, server, "testwithmultipledata", false, true);
}).then(() => {
return multiServers.broadcast(socket, server, "answer");
}).then(() => {
socket.disconnect();
});

@@ -781,0 +781,0 @@

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