New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

razorframe

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

razorframe - npm Package Compare versions

Comparing version

to
1.0.14

5

lib/Master.js

@@ -1,3 +0,1 @@

'use strict';
var cluster = require('cluster');

@@ -10,2 +8,5 @@ var util = require('util');

/* Master constructor
* adds logic to spawn and hash worker proesses
*/
function Master(workerCount) {

@@ -12,0 +13,0 @@ net.Server.call(this, {

34

lib/Razorframe.js

@@ -12,7 +12,5 @@ const { EventEmitter } = require('events');

const num_workers = require('os').cpus().length || 1;
const app = express();
/**Razorframe constructor

@@ -63,5 +61,8 @@ *

if (!listen(http, config.port)) {
// Master code
/*
* Master code area
*/
io.adapter(redisAdapter(REDIS_URL));
// Error listeners for Redis adapter
redisAdapter(REDIS_URL).pubClient.on('error', (err) => {

@@ -79,10 +80,12 @@ console.error(`[Master] Issue connecting Redis adapter to Pub Client: ${err}`);

} else {
// Worker code
/*
* Worker code area
*/
io.adapter(redisAdapter(REDIS_URL));
handleSockets(config);
// Error listeners for Redis adapter
redisAdapter(REDIS_URL).pubClient.on('error', (err) => {
console.error(`[Worker ${process.pid}] Issue connecting Redis adapter to Pub Client: ${err}`);
});
redisAdapter(REDIS_URL).subClient.on('error', (err) => {

@@ -127,4 +130,4 @@ console.error(`[Worker ${process.pid}] Issue connecting Redis adapter to Sub Client: ${err}`);

if (cluster.isMaster) {
// const workerCount = os.cpus().length || 1;
const workerCount = 4;
const workerCount = os.cpus().length || 1;
// const workerCount = 4;

@@ -159,4 +162,2 @@ const master = new Master(workerCount);

// Worker code
/**

@@ -168,3 +169,2 @@ * Worker logic for socket connections and event listeners

*/
const handleSockets = (config) => {

@@ -182,3 +182,3 @@ const { write, show } = config;

// Client listeners
// Client listeners----------------------
socket.on('msgSent', (MSG, id) => {

@@ -191,7 +191,9 @@ console.log('message recieved!------------------');

// Server-side listeners
// Server-side listeners----------------------
// Node error listener + reporter
rz.razorframe.notification.on('error', (err) => {
console.error('There was an error with event emitter communication: ' + err);
});
// Process error listener + reporter (move to after line 154???)
process.on('uncaughtException', (err) => {

@@ -205,2 +207,3 @@ console.error('(Process Error) There was an error with event emitter communication: ' + err);

// Apply incoming DB query supplied by MSG.action
rz.razorframe.notification.on('deq', (MSG) => {

@@ -225,2 +228,3 @@ switch (MSG.action) {

// If no error attached to MSG, then emit to clients
if (!MSG.error) {

@@ -227,0 +231,0 @@ if (MSG.contents === 'service') {

{
"name": "razorframe",
"version": "1.0.13",
"version": "1.0.14",
"description": "Empowering real-time databases in Node.js",

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