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.8 to 2.0.9

11

index.js

@@ -7,8 +7,17 @@ 'use strict';

const API = require('./lib/api');
const fs = require('fs');
const util = require('util');
const log_file = fs.createWriteStream(__dirname + '/error.log', {flags : 'a'});
const log_error = process.stderr;
console.error = function(d) {
log_file.write(util.format(d) + '\n');
log_error.write(util.format(d) + '\n');
};
module.exports = class {
constructor(token)
{
this._longpoll = new Longpoll(token);
this._api = new API(token);
this._longpoll = new Longpoll(this._api);
}

@@ -15,0 +24,0 @@

2

lib/api.js

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

{
if(body.error.error_code == 13)
if(body.error.error_code == 6)
{

@@ -51,0 +51,0 @@ for(let i in current)

@@ -8,6 +8,6 @@ 'use strict';

module.exports = class {
constructor(token)
constructor(api)
{
this._lpi = {};
this._token = token;
this._api = api;
this._lpStarted = false;

@@ -37,34 +37,14 @@ this._callback = {

{
return new Promise((resolve, reject) => {
request({
url: 'https://api.vk.com/method/messages.getLongPollServer',
timeout: 1e3,
qs: {
v: '5.62',
access_token: this._token
},
method: 'POST',
json: true,
form: {
use_ssl: 1,
need_pts: 0
}
}).then((body) => {
if('error' in body)
reject(body.error);
else if('response' in body)
{
this._lpi = {
server: body.response.server,
key: body.response.key,
ts: body.response.ts
};
process.nextTick(this.listen.bind(this));
this._lpStarted = true;
resolve();
}
}).catch((error) => {
console.error(error);
reject(error);
});
this._api.messages.getLongPollServer({
use_ssl: 1,
need_pts: 0
}).then((longPoll) => {
this._lpi = {
server: longPoll.server,
key: longPoll.key
};
if(!this._lpStarted)
this._lpi.ts = longPoll.ts;
process.nextTick(this.listen.bind(this));
this._lpStarted = true;
});

@@ -74,6 +54,3 @@ }

restart() {
this._lpStarted = false;
this.start().catch(() => {
process.nextTick(this.restart());
});
process.nextTick(this.restart());
}

@@ -97,2 +74,3 @@

{
console.error(body);
process.nextTick(this.restart.bind(this));

@@ -99,0 +77,0 @@ return;

@@ -50,6 +50,18 @@ {

"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",
"_id": "vk-fast-longpoll@2.0.1",
"_from": "vk-fast-longpoll@^2.0.7",
"_id": "vk-fast-longpoll@2.0.8",
"_inCache": true,

@@ -59,4 +71,4 @@ "_location": "/vk-fast-longpoll",

"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/vk-fast-longpoll-2.0.1.tgz_1490273913185_0.01708271517418325"
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/vk-fast-longpoll-2.0.8.tgz_1490369725073_0.5801886371336877"
},

@@ -68,42 +80,20 @@ "_npmUser": {

"_npmVersion": "4.1.2",
"_phantomChildren": {
"aws-sign2": "0.6.0",
"aws4": "1.6.0",
"caseless": "0.12.0",
"combined-stream": "1.0.5",
"extend": "3.0.0",
"forever-agent": "0.6.1",
"form-data": "2.1.2",
"har-validator": "4.2.1",
"hawk": "3.1.3",
"http-signature": "1.1.1",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.14",
"oauth-sign": "0.8.2",
"performance-now": "0.2.0",
"safe-buffer": "5.0.1",
"stringstream": "0.0.5",
"tough-cookie": "2.3.2",
"uuid": "3.0.1"
},
"_phantomChildren": {},
"_requested": {
"raw": "vk-fast-longpoll",
"raw": "vk-fast-longpoll@^2.0.7",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "",
"spec": "latest",
"type": "tag"
"rawSpec": "^2.0.7",
"spec": ">=2.0.7 <3.0.0",
"type": "range"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-2.0.1.tgz",
"_shasum": "e512eceb7296dd3c169beaff72b3bdd0ae9241be",
"_resolved": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-2.0.8.tgz",
"_shasum": "81e5798040dcb0a2509a07201fa12925f583b310",
"_shrinkwrap": null,
"_spec": "vk-fast-longpoll",
"_where": "D:\\Development\\Проекты\\Боты\\vk\\newbot",
"_spec": "vk-fast-longpoll@^2.0.7",
"_where": "D:\\Development\\Проекты\\Боты\\vk\\horoscope",
"author": {

@@ -124,4 +114,4 @@ "name": "Eugene Pogrebnyak"

"dist": {
"shasum": "e512eceb7296dd3c169beaff72b3bdd0ae9241be",
"tarball": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-2.0.1.tgz"
"shasum": "81e5798040dcb0a2509a07201fa12925f583b310",
"tarball": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-2.0.8.tgz"
},

@@ -142,3 +132,3 @@ "license": "ISC",

},
"version": "2.0.8"
"version": "2.0.9"
}
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