// initialize pubnub object
var pubnub = new PubNub({
subscribeKey: "yourSubscribeKey",
publishKey: "myPublishKey" // optional
})
// get up to the last 100 messages
// published to the channel
pubnub.history(
{
channel: 'channel1'
},
func...