<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.21.5.js"> </script>
<script type="text/javascript">
console.log('testtt');
var pubnub = new PubNub({
subscribeKey: "demo",
publishKey: "demo",
ssl: true
})
pubnub.subscribe({
channels: ['mahesh']
});
pubnub.publish({
channel: 'mahesh',
message: {
sender_name: 'Langote Mahesh',
message: "text,
date_time: "13 jan 2018",
}
});
pubnub.history(
{
channel: 'mahesh',
reverse: true,
count: 100
},
function (status, response) {
var data = response.messages;
$.each( data, function( key, value ) {
$.each( value, function( key, value ) {
if (key == "entry") {
console.log(key + " : "+ value);
console.log(value.sender_name);
console.log(value.message);
console.log(value.date_time);
}
});
});
}
);
<script type="text/javascript">
console.log('testtt');
var pubnub = new PubNub({
subscribeKey: "demo",
publishKey: "demo",
ssl: true
})
pubnub.subscribe({
channels: ['mahesh']
});
pubnub.publish({
channel: 'mahesh',
message: {
sender_name: 'Langote Mahesh',
message: "text,
date_time: "13 jan 2018",
}
});
pubnub.history(
{
channel: 'mahesh',
reverse: true,
count: 100
},
function (status, response) {
var data = response.messages;
$.each( data, function( key, value ) {
$.each( value, function( key, value ) {
if (key == "entry") {
console.log(key + " : "+ value);
console.log(value.sender_name);
console.log(value.message);
console.log(value.date_time);
}
});
});
}
);
No comments:
Post a Comment