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

metacom

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metacom - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

22

lib/client.js

@@ -11,2 +11,3 @@ 'use strict';

const RECONNECT_TIMEOUT = 2 * 1000;
const PING_PACKET = Buffer.from('{}');

@@ -121,3 +122,3 @@ const connections = new Set();

} else {
const stream = new MetaReadable({ id, name, size });
const stream = new MetaReadable(id, name, size);
this.streams.set(id, stream);

@@ -140,4 +141,3 @@ }

async binary(blob) {
const buffer = await blob.arrayBuffer();
async binary(buffer) {
const byteView = new Uint8Array(buffer);

@@ -166,3 +166,3 @@ const { id, payload } = chunkDecode(byteView);

const packet = { type: 'event', name, data };
this.send(JSON.stringify(packet));
this.send(packet);
});

@@ -190,3 +190,3 @@ this.api[unit] = methods;

const packet = { type: 'call', id, method: target, args };
this.send(JSON.stringify(packet));
this.send(packet);
});

@@ -228,3 +228,3 @@ };

const interval = Date.now() - this.lastActivity;
if (interval > this.pingInterval) this.send('{}');
if (interval > this.pingInterval) this.write(PING_PACKET);
}

@@ -253,3 +253,3 @@ }, this.pingInterval);

send(data) {
write(data) {
if (!this.connected) return;

@@ -259,2 +259,8 @@ this.lastActivity = Date.now();

}
send(data) {
if (!this.connected) return;
this.lastActivity = Date.now();
this.socket.send(JSON.stringify(data));
}
}

@@ -279,3 +285,3 @@

headers: { 'Content-Type': 'application/json' },
body: data,
body: JSON.stringify(data),
}).then((res) =>

@@ -282,0 +288,0 @@ res.text().then((packet) => {

@@ -211,3 +211,3 @@ 'use strict';

connection.on('message', (data, isBinary) => {
if (isBinary) this.binary(client, data);
if (isBinary) this.binary(client, new Uint8Array(data));
else this.message(client, data);

@@ -214,0 +214,0 @@ });

{
"name": "metacom",
"version": "3.0.1",
"version": "3.0.2",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -60,13 +60,13 @@ "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access",

"devDependencies": {
"@types/node": "^20.4.3",
"@types/node": "^20.5.0",
"@types/ws": "^8.5.5",
"eslint": "^8.45.0",
"eslint": "^8.47.0",
"eslint-config-metarhia": "^8.2.1",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-prettier": "^5.0.0",
"metatests": "^0.8.2",
"prettier": "^3.0.0",
"prettier": "^3.0.1",
"typescript": "^5.1.6"
}
}
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