Comparing version 3.7.15 to 3.7.16
@@ -7,44 +7,42 @@ /* --------------------------------------------------------------------------- | ||
--------------------------------------------------------------------------- */ | ||
var pubnub = require("./../pubnub.js"); | ||
var channel = 'my_channel'; | ||
var network = pubnub.init({ | ||
var PUBNUB = require("./../pubnub.js"); | ||
var channel = 'my_channel1'; | ||
var pubnub = PUBNUB.init({ | ||
publish_key : "demo", | ||
subscribe_key : "demo", | ||
cipher_key : "enigma" | ||
}); | ||
var pubnub1 = PUBNUB.init({ | ||
publish_key : "demo", | ||
subscribe_key : "demo" | ||
}); | ||
/* --------------------------------------------------------------------------- | ||
Print All | ||
--------------------------------------------------------------------------- */ | ||
get_all_history({ | ||
channel : channel, | ||
callback : function(messages) { | ||
console.log(messages); | ||
} | ||
}) | ||
pubnub.history({ | ||
'channel' : channel, | ||
'callback' : function(r) { | ||
console.log(JSON.stringify(r)); | ||
}, | ||
'error' : function(r) { | ||
/* --------------------------------------------------------------------------- | ||
Get All History Message for a CHANNEL | ||
--------------------------------------------------------------------------- */ | ||
function get_all_history(args) { | ||
var channel = args['channel'] | ||
, callback = args['callback'] | ||
, start = 0 | ||
, history = []; | ||
} | ||
}); | ||
pubnub.history({ | ||
'include_token' : true, | ||
'channel' : channel, | ||
'callback' : function(r) { | ||
console.log(JSON.stringify(r)); | ||
}, | ||
'error' : function(r) { | ||
(function add_messages() { | ||
network.detailedHistory({ | ||
channel : channel, | ||
start : start, | ||
reverse : true, | ||
callback : function(messages) { | ||
var msgs = messages[0] | ||
, end = start = messages[2]; | ||
} | ||
}); | ||
pubnub1.history({ | ||
'include_token' : true, | ||
'channel' : channel, | ||
'callback' : function(r) { | ||
console.log(JSON.stringify(r)); | ||
}, | ||
'error' : function(r) { | ||
if (!msgs.length) return callback(history); | ||
history = history.concat(msgs); | ||
add_messages(); | ||
} | ||
}); | ||
})(); | ||
} | ||
} | ||
}); |
@@ -108,3 +108,3 @@ /* --------------------------------------------------------------------------- | ||
try { response = JSON['parse'](body); } | ||
catch (r) { return done(1); } | ||
catch (r) { return done(1, {"error" : true, "message" : "error in response parsing"}); } | ||
success(response); | ||
@@ -127,3 +127,3 @@ } | ||
} | ||
, timer = timeout( function(){done(1);} , xhrtme ); | ||
, timer = timeout( function(){done(1, {"error" : true, "message" : "timeout"})} , xhrtme ); | ||
@@ -166,4 +166,4 @@ data['pnsdk'] = PNSDK; | ||
response.setEncoding('utf8'); | ||
response.on( 'error', function(){done(1, body || { "error" : "Network Connection Error"})}); | ||
response.on( 'abort', function(){done(1, body || { "error" : "Network Connection Error"})}); | ||
response.on( 'error', function(){done(1, body || { "error" : true, "message" : "Network Connection Error"})}); | ||
response.on( 'abort', function(){done(1, body || { "error" : true, "message" : "Network Connection Error"})}); | ||
response.on( 'data', function (chunk) { | ||
@@ -191,3 +191,3 @@ if (chunk) body += chunk; | ||
request.on( 'error', function() { | ||
done( 1, {"error":"Network Connection Error"} ); | ||
done( 1, {"error": true, "message" : "Network Connection Error"} ); | ||
} ); | ||
@@ -194,0 +194,0 @@ |
{ | ||
"name": "pubnub", | ||
"preferGlobal": false, | ||
"version": "3.7.15", | ||
"version": "3.7.16", | ||
"author": "PubNub <stephen@pubnub.com>", | ||
@@ -18,2 +18,3 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", | ||
"main": "./node.js/pubnub.js", | ||
"browser": "./modern/pubnub.js", | ||
"repository": { | ||
@@ -55,2 +56,3 @@ "type": "git", | ||
"node.js", | ||
"web/pubnub.js", | ||
"CHANGELOG", | ||
@@ -57,0 +59,0 @@ "FUTURE.md", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
537476
55
9297