Reading through @ifandelse's pull request (https://github.com/appendto/amplify/pull/47) I felt like we could solve the identifying the topic pretty easily and explored that approach in this pull request.
I've included the multiple topic documentation that @ifandelse started then extended amplify to include the passing of 'topic' as the last argument to the callback function, optional of course. here's the examples of how this would work:
amplify.subscribe( "lion kitty dog", function( data, topic ) {
console.log( "The " + topic + " says '" + data.bar + "'." );
});
amplify.publish( "lion", { bar: "RAWR!" } ); // The lion says 'RAWR!'.
amplify.publish( "kitty", { bar: "meow" } ); // The kitty says 'meow'.
amplify.publish( "dog", { bar: "Woof!" } ); // The dog says 'Woof!'.
I've included tests and documentation for subscribing multiple topics and identifying the topic published.
Reading through @ifandelse's pull request (https://github.com/appendto/amplify/pull/47) I felt like we could solve the identifying the topic pretty easily and explored that approach in this pull request.
I've included the multiple topic documentation that @ifandelse started then extended amplify to include the passing of 'topic' as the last argument to the callback function, optional of course. here's the examples of how this would work:
I've included tests and documentation for subscribing multiple topics and identifying the topic published.