I'm using Ably to implement Pub/Sub in my application but I'm getting no errors but at the same time I'm not receiving any published messages. I'm not sure what's wrong. Help appreciated.
Here's my code:
//publisher
var Ably = require('ably');
var apiKey = '';
var ably = new Ably.Realtime({key: apiKey});
var pubChannel = ably.channels.get("sports");
setInterval(function(){
pubChannel.publish('update', {'Team': 'Man United'})
},1000)
//subscriber
var apiKey = '';
var ably = new Ably.Realtime({key: apiKey});
var subChannel = ably.channels.get("Sports");
subChannel.subscribe(function(msg){
document.getElementById('text').innerHTML = JSON.stringify(msg.data);
})
(disclaimer: I am a developer advocate for Ably, and posting and self-answering a commonly asked support question here on Stack Overflow so our users can find this more easily)