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

eventsocket

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventsocket - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

22

lib/EventSocket.js

@@ -15,19 +15,19 @@ var net = require('net');

function EventSocket(ip, port) {
function EventSocket() {
var eventSocket = this;
var socket;
if (isString(ip)) {
log('connecting... %s:%s', ip, port);
socket = new JsonSocket(ip, port);
} else if (ip instanceof JsonSocket) {
socket = ip;
} else if (ip instanceof net.Socket) {
socket = new JsonSocket(ip);
if (arguments[0] instanceof JsonSocket) {
socket = arguments[0];
} else if (arguments[0] instanceof net.Socket) {
socket = new JsonSocket(arguments[0]);
} else {
return;
var args = Array.prototype.concat.apply([null], arguments);
socket = new (Function.prototype.bind.apply(JsonSocket, args))();
}
socket.on('connect', function () {
log('connect');
emit('connect');
});
socket.on('json', function (json) {

@@ -57,2 +57,6 @@ if (isString(json.name)) {

eventSocket.connect = function () {
socket.connect.apply(socket, arguments);
};
var _emit = eventSocket.emit;

@@ -59,0 +63,0 @@

{
"name": "eventsocket",
"version": "1.0.2",
"version": "1.0.3",
"description": "Event socket",

@@ -27,3 +27,3 @@ "main": "index.js",

"debug": "^2.1.1",
"jsonsocket": "^1.0.1"
"jsonsocket": "^1.0.2"
},

@@ -30,0 +30,0 @@ "devDependencies": {

@@ -18,5 +18,7 @@ # eventsocket

### `EventSocket(ip, port)`
### `EventSocket(options)`
### `EventSocket(port, [host])`
### `EventSocket(path)`
Create new event socket from ip and port.
Create new event socket. Same as [`net.connect`](http://nodejs.org/api/net.html#net_net_connect_options_connectionlistener).

@@ -49,2 +51,8 @@ ```js

### `connect(port, [host])`
### `connect(path)`
Same as [`net.Socket.connect`](http://nodejs.org/api/net.html#net_socket_connect_port_host_connectlistener)
### `on(eventType, listener)`

@@ -51,0 +59,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