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

vk-fast-longpoll

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vk-fast-longpoll - npm Package Compare versions

Comparing version 2.0.14 to 2.0.15

40

lib/api.js
'use strict';
const methods = require('./methods');
const async = require('async');
const Promise = require('bluebird');
const request = require('request-promise');
const request = require('request');
const fs = require('fs');
const util = require('util');
const log_file = fs.createWriteStream(__dirname + '/api.log', {flags : 'a'});
const log_error = process.stderr;
const winston = require('winston');
console.error = function(d) {
log_file.write(util.format(d) + '\n');
log_error.write(util.format(d) + '\n');
};
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({ filename: './api.log' })
]
});

@@ -23,3 +22,3 @@ module.exports = class {

this._queue = [];
this._time = 200;
this._time = 220;

@@ -56,3 +55,14 @@ let _apiCall = (method,params = {}) => {

let executeHandler = (current, body) => {
let executeHandler = (current, err, res, body) => {
if(res.statusCode != 200 || err)
{
if(res.statusCode != 200)
logger.error(res.statusCode + ' | ' + res.statusMessage);
else if(err)
logger.error(err);
for(let i in current)
this._queue.unshift(current[i]);
setTimeout(this._executeLoop, this._time);
return;
}
if('error' in body)

@@ -68,3 +78,3 @@ {

{
console.error(body.error);
logger.error(body.error);
setTimeout(this._executeLoop, this._time);

@@ -82,3 +92,3 @@ }

url: 'https://api.vk.com/method/execute',
timeout: 1e3,
timeout: 2e3,
qs: {

@@ -91,5 +101,3 @@ v: '5.62',

form: { code: code }
}).then(executeHandler.bind(this, current)).catch((error) => {
setTimeout(self._executeLoop, self._time);
});
}, executeHandler.bind(this, current));
}

@@ -96,0 +104,0 @@ else

39

lib/longpoll.js
'use strict';
const request = require('request-promise');
const request = require('request');
const querystring = require('querystring');

@@ -8,9 +8,10 @@ const Promise = require('bluebird');

const util = require('util');
const log_file = fs.createWriteStream(__dirname + '/longpoll.log', {flags : 'a'});
const log_error = process.stderr;
const winston = require('winston');
console.error = function(d) {
log_file.write(util.format(d) + '\n');
log_error.write(util.format(d) + '\n');
};
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({ filename: './longpoll.log' })
]
});

@@ -50,3 +51,3 @@ module.exports = class {

}).then((longPoll) => {
console.log(longPoll);
logger.log(longPoll);
this._lpi = {

@@ -61,3 +62,3 @@ server: longPoll.server,

}).catch((error) => {
console.error(error);
logger.error(error);
process.nextTick(this.start.bind(this));

@@ -67,9 +68,5 @@ });

restart() {
process.nextTick(this.start.bind(this));
}
listen() {
request({
url: 'https://' + this._lpi.server,
url: 'https://a' + this._lpi.server,
timeout: 20e3,

@@ -85,3 +82,8 @@ json: true,

}
}).then((body) => {
}, (err, res, body) => {
if(res.statusCode != 200 || err)
{
process.nextTick(this.listen.start(this));
return;
}
if('failed' in body)

@@ -103,6 +105,6 @@ {

case 4:
console.error('Передан недопустимый номер версии в параметре version');
logger.error('Передан недопустимый номер версии в параметре version');
break;
default:
console.error(body);
logger.error(body);
break;

@@ -117,5 +119,2 @@ }

process.nextTick(this.listen.bind(this));
}).catch((error) => {
console.error(error);
process.nextTick(this.listen.bind(this));
});

@@ -122,0 +121,0 @@ }

{
"_args": [
[
{
"raw": "vk-fast-longpoll",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"D:\\Development\\Projects\\translate-bot"
],
[
{
"raw": "vk-fast-longpoll",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"D:\\Development\\Projects\\маникюр2.0"
],
[
{
"raw": "vk-fast-longpoll",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"C:\\Users\\tuxic\\OneDrive\\Проекты\\Модули\\Node.JS"
],
[
{
"raw": "vk-fast-longpoll",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"D:\\Development\\Проекты\\Боты\\vk\\newbot"
],
[
{
"raw": "vk-fast-longpoll@^2.0.7",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "^2.0.7",
"spec": ">=2.0.7 <3.0.0",
"type": "range"
},
"D:\\Development\\Проекты\\Боты\\vk\\horoscope"
]
],
"_from": "vk-fast-longpoll@^2.0.7",
"_id": "vk-fast-longpoll@2.0.8",
"_inCache": true,
"_location": "/vk-fast-longpoll",
"_nodeVersion": "7.7.4",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/vk-fast-longpoll-2.0.8.tgz_1490369725073_0.5801886371336877"
},
"_npmUser": {
"name": "tuxick",
"email": "emcifuntik@live.com"
},
"_npmVersion": "4.1.2",
"_phantomChildren": {},
"_requested": {
"raw": "vk-fast-longpoll@^2.0.7",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "^2.0.7",
"spec": ">=2.0.7 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-2.0.8.tgz",
"_shasum": "81e5798040dcb0a2509a07201fa12925f583b310",
"_shrinkwrap": null,
"_spec": "vk-fast-longpoll@^2.0.7",
"_where": "D:\\Development\\Проекты\\Боты\\vk\\horoscope",
"author": {

@@ -100,6 +6,5 @@ "name": "Eugene Pogrebnyak"

"dependencies": {
"async": "^2.1.5",
"bluebird": "^3.5.0",
"request": "^2.81.0",
"request-promise": "^4.2.0"
"winston": "^2.3.1"
},

@@ -129,3 +34,3 @@ "description": "VK Lib for better performance",

},
"version": "2.0.14"
"version": "2.0.15"
}
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