I've implemented a simple streaming api code for subscription to the push topic using a callback function. It's realy needed because the official CotemD documentation expressly points to it:
Calling subscribe() does not mean that you have completed the subscription with the server when function returns.
If you want to be certain that the server received your subscription request (or not), you can ... pass a callback function to subscribe()
Here is my subscribe function:
subscription = jQuery.cometd.subscribe('/topic/MyPushObject',
function(message){ handleMessage(message); },
function(subscribeReply){
// THIS PIECE OF CODE IS NEVER CALLED
if (subscribeReply.successful){
console.log('subscribe success');
}
else{
console.log('subscribe failed');
}
});
I can successfully subscribe to the push topic but the callback function is never called (no console log, no break points in browser).
Am I missing something here?