Skip to content

Instantly share code, notes, and snippets.

@benfoxall
Last active August 29, 2015 13:56
Show Gist options
  • Save benfoxall/8918328 to your computer and use it in GitHub Desktop.
Save benfoxall/8918328 to your computer and use it in GitHub Desktop.
PubNub backfill issue
var pubnub = PUBNUB.init({
publish_key : 'pub-c-your-key',
subscribe_key : 'sub-c-your-key',
});
/*---- setup - paste in console a few times to put some messages in A */
pubnub.publish({
channel:'A',
message:'testing-' + Math.random()
})
/*---- 1. subscribing to 'A' with backfill works */
pubnub.subscribe({
channel:'A',
callback: function(m){console.log("A>",m)},
backfill:true
})
/*---- 2. subscribing to 'A' with backfill, then 'B' without fails (cancelled xhr in console) */
pubnub.subscribe({
channel:'A',
callback: function(m){console.log("A>",m)},
backfill:true
})
pubnub.subscribe({
channel:'B',
callback: function(m){console.log("B>",m)},
backfill:false
})
@benfoxall
Copy link
Author

(note, I'm using multiplexed channels)

@stephenlb
Copy link

Hi @benfoxall What is the issue, it looks like it is working very well! 👍 You've got two subscribes with channel "A" which is okay. By subscribing to channel "B" you are invoking the SDK to shutdown the TCP socket and open a new one for channels "A" + "B".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment