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

antena

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antena - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

31

node/attach.js

@@ -13,2 +13,3 @@

socket.on("error", onerror);
socket.setNoDelay(true);
Messaging.initialize(socket);

@@ -29,6 +30,6 @@ Messaging.input(socket, receive_initial);

this._antena_session = string.substring(1);
if (string[0] === "?") {
Messaging.input(this, receive_request);
} else if (string[0] === "_") {
Messaging.input(this, receive_message);
if (string[0] === "@") {
Messaging.input(this, receive);
} else if (string[0] === "#") {
Messaging.input(this, receive_error);
const connection = this._antena_receptor._connections[this._antena_session];

@@ -40,3 +41,3 @@ if (connection && !Array.isArray(connection)) {

for (let index = 0; index < connection.length; index++) {
this.send(Messaging.output(connection[index]));
Messaging.output(this, connection[index]);
}

@@ -49,3 +50,3 @@ }

} else {
this.destroy(new Error("Initial message should start with either '?' or '_'"));
this.destroy(new Error("Initial message should start with either '@' or '#', got: "+string));
}

@@ -62,10 +63,16 @@ }

function receive_request (string) {
this._antena_receptor.onrequest(this._antena_session, string, (string) => {
Messaging.output(this, string);
});
function receive (string) {
if (string[0] === "?") {
this._antena_receptor.onrequest(this._antena_session, string.substring(1), (string) => {
Messaging.output(this, string);
});
} else if (string[0] === "!") {
this._antena_receptor.onmessage(this._antena_session, string.substring(1));
} else {
this.destroy(new Error("Incoming message should start with either '?' or '!', got: "+string));
}
}
function receive_message (string) {
this._antena_receptor.onmessage(this._antena_session, string);
function receive_error (string) {
this.destroy(new Error("This socket should not receive anything, got: "+string));
}
const Net = require("net");
const PosixSocket = require("posix-socket");
const Net = require("net");
const Messaging = require("./messaging.js");

@@ -89,7 +89,5 @@

PosixSocket.connect(emitter._sockfd, address.posix);
if (address.domain !== PosixSocket.AF_LOCAL) {
if (address.domain !== PosixSocket.AF_LOCAL)
PosixSocket.setsockopt(emitter._sockfd, PosixSocket.IPPROTO_TCP, PosixSocket.TCP_NODELAY, 1);
emitter._socket.setNoDelay(true);
}
output(emitter._sockfd, "?"+session);
output(emitter._sockfd, "@"+session);
const buffer = Buffer.allocUnsafe(Buffer.byteLength(session)+5);

@@ -100,3 +98,3 @@ emitter._socket._antena_emitter = emitter;

Messaging.input(emitter._socket, onmessage);
Messaging.output(emitter._socket, "_"+session);
Messaging.output(emitter._socket, "#"+session);
return emitter;

@@ -118,7 +116,7 @@ };

function send (string) {
Messaging.output(this._socket, string);
output(this._sockfd, "!"+string);
}
function request (string) {
output(this._sockfd, string);
output(this._sockfd, "?"+string);
PosixSocket.recv(this._sockfd, BUFFER, 4, PosixSocket.MSG_WAITALL);

@@ -125,0 +123,0 @@ const length = HEAD_VIEW[0];

@@ -12,3 +12,3 @@

if (buffer.length > boundary) {
ondata.call(this, buffer.slice(0, boundary));
ondata.call(this, buffer.slice(boundary));
}

@@ -64,1 +64,2 @@ } else {

};
{
"name": "antena",
"description": "Isomorphic communication library",
"version": "2.0.0",
"version": "2.0.1",
"author": {

@@ -6,0 +6,0 @@ "name": "Laurent Christophe",

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