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 1.0.0 to 1.0.1

55

index.js

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

{
config = {
this.config = {
token: null,

@@ -20,2 +20,4 @@ id: null,

}
else
this.config = config;
this.queue = [];

@@ -46,15 +48,15 @@ this.callback = {

requestLongPollServer((longPollInfo) => {
requestLongPollServer(this, (object, longPollInfo) => {
lpi = longPollInfo;
requestNewMessages();
requestNewMessages(object);
});
setInterval(() => {
requestLongPollServer((longPollInfo) => {
setInterval((object) => {
requestLongPollServer(object, (object, longPollInfo) => {
lpi.key = longPollInfo.key;
lpi.server = longPollInfo.server;
});
}, 600000);
}, 600000, this);
function onUpdate(updates)
function onUpdate(object, updates)
{

@@ -80,5 +82,5 @@ for(let i in updates)

{
for(let i in this.callback.message)
for(let i in object.callback.message)
{
this.callback.message(new Message(update[1], update[2], update[3], update[4], update[5], (update.length > 6) ? update[6] : null));
object.callback.message[i](new Message(update[1], update[2], update[3], update[4], update[5], ((update[6] != undefined) ? (update[6]) : (null))));
}

@@ -91,3 +93,3 @@ break;

function requestNewMessages()
function requestNewMessages(object)
{

@@ -110,5 +112,5 @@ https.get('https://' + lpi.server + '?' +

let updateInfo = JSON.parse(fullData)
onUpdate(updateInfo.updates);
onUpdate(object, updateInfo.updates);
lpi.ts = updateInfo.ts;
setTimeout(requestNewMessages, 1);
setTimeout(requestNewMessages, 1, object);
});

@@ -121,7 +123,7 @@ }

function requestLongPollServer(callback)
function requestLongPollServer(object, callback)
{
https.get('https://api.vk.com/method/messages.getLongPollServer?' + querystring.stringify({
v: 5.62,
access_token: config.token,
access_token: object.config.token,
use_ssl: 1,

@@ -138,3 +140,3 @@ need_pts: 0

let longPollInfo = JSON.parse(fullData).response;
callback(longPollInfo);
callback(object, longPollInfo);
});

@@ -147,11 +149,11 @@ }

function sendQueue()
function sendQueue(object)
{
if(queue.length == 0)
if(object.queue.length == 0)
{
setTimeout(sendQueue, 10);
setTimeout(sendQueue, 10, object);
return;
}
let count = (queue.length > 25) ? 25 : (queue.length);
let queuePart = queue.splice(0, count-1);
let count = (object.queue.length > 25) ? 25 : (object.queue.length);
let queuePart = object.queue.splice(0, count);
let queueText = queuePart.join('\r\n');

@@ -161,3 +163,3 @@

code: queueText,
access_token: config.token,
access_token: object.config.token,
v: 5.62

@@ -189,5 +191,5 @@ });

for(let i in queuePart)
queue.unshift(queuePart[i]);
object.queue.unshift(queuePart[i]);
}
setTimeout(sendQueue, 200);
setTimeout(sendQueue, 200, object);
});

@@ -198,3 +200,3 @@ });

}
sendQueue();
sendQueue(this);
}

@@ -293,2 +295,7 @@

}
sendMessage(options)
{
this.queue.push('API.messages.send(' + JSON.stringify(options) + ');');
}
}

@@ -5,21 +5,27 @@ 'use strict';

constructor(id, flags, sender, subject, text, attachments) {
this.id = id;
this.flags = flags;
this.subject = subject;
this.sender = sender;
this.text = text;
this.attachments = attachments;
constructor(id, flags, sender, timestamp, subject, text, attachments) {
this._id = id;
this._flags = flags;
this._timestamp = timestamp;
this._subject = subject;
this._sender = sender;
this._text = text;
this._attachments = attachments;
}
get isUnread() { return (this.flags & 1) == 1; }
get isOutbox() { return (this.flags & 2) == 2; }
get isReplied() { return (this.flags & 4) == 4; }
get isImportant() { return (this.flags & 8) == 8; }
get isChat() { return (this.flags & 16) == 16; }
get isFriends() { return (this.flags & 32) == 32; }
get isSpam() { return (this.flags & 64) == 64; }
get isDeleted() { return (this.flags & 128) == 128; }
get isFixed() { return (this.flags & 256) == 256; }
get isMedia() { return (this.flags & 512) == 512; }
get sender() { return this._sender; }
get id() { return this._id; }
get timestamp() { return this._timestamp; }
get subject() { return this._subject; }
get text() { return this._text; }
get isUnread() { return (this._flags & 1) == 1; }
get isOutbox() { return (this._flags & 2) == 2; }
get isReplied() { return (this._flags & 4) == 4; }
get isImportant() { return (this._flags & 8) == 8; }
get isChat() { return (this._flags & 16) == 16; }
get isFriends() { return (this._flags & 32) == 32; }
get isSpam() { return (this._flags & 64) == 64; }
get isDeleted() { return (this._flags & 128) == 128; }
get isFixed() { return (this._flags & 256) == 256; }
get isMedia() { return (this._flags & 512) == 512; }
}
{
"name": "vk-fast-longpoll",
"version": "1.0.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"
]
],
"_from": "vk-fast-longpoll@latest",
"_id": "vk-fast-longpoll@1.0.0",
"_inCache": true,
"_location": "/vk-fast-longpoll",
"_nodeVersion": "7.4.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/vk-fast-longpoll-1.0.0.tgz_1489344547236_0.9723926121369004"
},
"_npmUser": {
"name": "tuxick",
"email": "emcifuntik@live.com"
},
"_npmVersion": "4.0.5",
"_phantomChildren": {},
"_requested": {
"raw": "vk-fast-longpoll",
"scope": null,
"escapedName": "vk-fast-longpoll",
"name": "vk-fast-longpoll",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-1.0.0.tgz",
"_shasum": "66868e0b54820be4b24f42145cf7180a635f9863",
"_shrinkwrap": null,
"_spec": "vk-fast-longpoll",
"_where": "D:\\Development\\Projects\\translate-bot",
"author": {
"name": "Eugene Pogrebnyak"
},
"dependencies": {
"fs": "0.0.1-security",
"https": "^1.0.0",
"querystring": "^0.2.0"
},
"description": "VK Lib for better performance",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "66868e0b54820be4b24f42145cf7180a635f9863",
"tarball": "https://registry.npmjs.org/vk-fast-longpoll/-/vk-fast-longpoll-1.0.0.tgz"
},
"license": "ISC",
"main": "index.js",
"maintainers": [
{
"name": "tuxick",
"email": "emcifuntik@live.com"
}
],
"name": "vk-fast-longpoll",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"scripts": {
"test": "node index.js"
},
"author": "Eugene Pogrebnyak",
"license": "ISC",
"dependencies": {
"fs": "0.0.1-security",
"https": "^1.0.0",
"querystring": "^0.2.0"
}
"version": "1.0.1"
}
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