facebook-chat-api
Advanced tools
Comparing version 0.2.2 to 0.2.3
16
index.js
@@ -140,10 +140,8 @@ /*jslint node: true */ | ||
function firstPullReq(res, ctx, mergeWithDefaults, api) { | ||
var html = res.body; | ||
time.reportPullSent(); | ||
log.info("Request to pull 1"); | ||
log.info('Request to pull 1'); | ||
var form = { | ||
'channel' : "p_" + ctx.userId, | ||
'seq' : '0', | ||
'partition' : '-2', | ||
'channel' : 'p_' + ctx.userId, | ||
'seq' : 0, | ||
'partition' : -2, | ||
'clientid' : ctx.clientid, | ||
@@ -153,5 +151,5 @@ 'viewer_uid' : ctx.userId, | ||
'state' : 'active', | ||
'format' : 'json', | ||
'idle' : 0, | ||
'cap' : '8' | ||
'cap' : 8, | ||
'msgs_recv':0 | ||
}; | ||
@@ -163,2 +161,4 @@ return [utils.get("https://0-edge-chat.facebook.com/pull", ctx.jar, form).then(utils.parseResponse), ctx, mergeWithDefaults, api, form]; | ||
form.wtc = time.doSerialize(); | ||
if (resData.t !== 'lb') throw new Error("Bad response from pull 1"); | ||
form.sticky_token = resData.lb_info.sticky; | ||
@@ -165,0 +165,0 @@ form.sticky_pool = resData.lb_info.pool; |
{ | ||
"name": "facebook-chat-api", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Facebook chat API that doesn't rely on XMPP. Will NOT be deprecated April 30th 2015.", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
@@ -8,2 +8,4 @@ /*jslint node: true */ | ||
var msgs_recv = 0; | ||
module.exports = function(mergeWithDefaults, api, ctx) { | ||
@@ -22,3 +24,3 @@ var shouldStop = false; | ||
var form = { | ||
'channel' : "p_" + ctx.userId, | ||
'channel' : 'p_' + ctx.userId, | ||
'seq' : '0', | ||
@@ -30,5 +32,5 @@ 'partition' : '-2', | ||
'state' : 'active', | ||
'format' : 'json', | ||
'idle' : 0, | ||
'cap' : '8' | ||
'cap' : '8', | ||
'msgs_recv':msgs_recv | ||
}; | ||
@@ -86,2 +88,3 @@ | ||
if(resData.ms) { | ||
msgs_recv += resData.ms.length; | ||
var atLeastOne = false; | ||
@@ -88,0 +91,0 @@ resData.ms.sort(function(a, b) { |
67002
1183