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

@smartface/smartface.emulator

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smartface/smartface.emulator - npm Package Compare versions

Comparing version

to
0.0.8

66

main.js

@@ -37,2 +37,5 @@ var SMFC_WS;

var wsConnectionStatus = STATUS.DISCONNECTED;
var MAX_RETRY_COUNT = 10;
var retryCount = MAX_RETRY_COUNT;
var retryInterval = null;

@@ -233,3 +236,3 @@ var CONSTANTS = {

var args_str = (CONSTANTS.logToConsole) ? ' --logToConsole=1' : '';
proc.spawn("smartface-cloud-emulator-dispatcher" + args_str, function(err, process) {
proc.spawn("smartface-cloud-emulator-dispatcher", {args: [args_str]}, function(err, process) {
if (err) {

@@ -251,6 +254,8 @@ throw err;

});
// process.stderr.on("data", function(chunk) {
// console.log(chunk.toString());
// dialogError(chunk);
// });
process.stderr.on("data", function(chunk) {
if (CONSTANTS.logToConsole) {
console.log(chunk.toString());
dialogError(chunk);
}
});
});

@@ -323,4 +328,9 @@ }

var ws = new WebSocket(ws_url);
var timer = null;
ws.onopen = function() {
ws.onopen = onopen;
ws.onerror = onerror;
ws.onclose = onclose;
ws.onmessage = onmessage;
function onopen() {
if (CONSTANTS.logToConsole) {

@@ -330,16 +340,20 @@ console.log('ws connected');

SMFC_WS = ws;
timer = setInterval(function() {
ws.send("{\"command\":\"keepAlive\"}");
}, 15000);
if (qrCodeUrl !== "") // checking if qr code generated or not
changeQRImageToUrl(qrCodeUrl);
wsConnectionStatus = STATUS.CONNECTED;
if (retryInterval) {
clearInterval(retryInterval);
retryInterval = null;
retryCount = MAX_RETRY_COUNT;
}
};
ws.onerror = function(e) {
console.log('ws error', e);
function onerror(e) {
if (CONSTANTS.logToConsole){
console.log('ws error', e);
}
};
ws.onclose = function(e) {
if (timer) {
clearInterval(timer);
}
function onclose(e) {
if (CONSTANTS.logToConsole) {

@@ -349,4 +363,22 @@ console.log('ws closed', e);

wsConnectionStatus = STATUS.DISCONNECTED;
// try to reconnect dispatcher 10 times
if (!retryInterval){
retryInterval = setInterval(function () {
if (retryCount !== 0 && wsConnectionStatus === STATUS.DISCONNECTED){
if (CONSTANTS.logToConsole) {
console.log("trying to reconnect to dispatcher");
}
retryCount--;
ws = new WebSocket(ws_url);
ws.onopen = onopen;
ws.onerror = onerror;
ws.onclose = onclose;
ws.onmessage = onmessage;
}
}, 2000);
}
};
ws.onmessage = function(msgevent) {
function onmessage(msgevent) {
var json;

@@ -353,0 +385,0 @@ if (CONSTANTS.logToConsole) {

{
"name": "@smartface/smartface.emulator",
"version": "0.0.7",
"version": "0.0.8",
"description": "SmartfaceCloud Emulator",

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