Skip to content

Instantly share code, notes, and snippets.

@madhur
Created May 26, 2016 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madhur/7b9113c05aec03467183ca3469fad0b3 to your computer and use it in GitHub Desktop.
Save madhur/7b9113c05aec03467183ca3469fad0b3 to your computer and use it in GitHub Desktop.
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