Created
May 26, 2016 02:46
-
-
Save madhur/7b9113c05aec03467183ca3469fad0b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var amqp = require('amqplib'); | |
var http = require('http'); | |
var PUBNUB = require('pubnub'); | |
pubnub = PUBNUB({ | |
publish_key: 'demo', | |
subscribe_key: 'demo' | |
}); | |
publish() | |
var publishTime; | |
var callbackTime; | |
function publish() { | |
publishTime = new Date(); | |
pubnub.publish({"message": {"hi": "there"}, "channel": "max_ch1323", callback: function(a,b,c) { | |
callbackTime = new Date(); | |
publishTimeToken = parseInt(a[2]) | |
console.log("pubish time: " + publishTime, "callback time: " + callbackTime, "publish time: " + (callbackTime - publishTime), "server timetoken: " + publishTimeToken) | |
previousTime = publishTimeToken; | |
publish() | |
}}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment