I added https://github.com/ably/ably-js to my project so that I can use typescript. Currently my document adds the currentBid information to the mongodb document with the corresponding auctionId. I'm trying to associate the auctionId with the currentBid value so that the correct value assigns to the correct auction using ABLY so I assigned the channel name to the auctionId with the currentBid value as the data. Here's my code below. Currently it does say publish succeeded in the ably Your app statistics summary
and it does register the message according to it's message counter.
Right now on the channel.subscribe, the innerHTML turns into a JSON object on the screen when bid happens. Not sure how I'm gonna associate correct auctionId. How would I query the channels I publish?
The value that returns in innerHTML is If the currentBid is $205.00 and I bid $15.00 then the channel.subscribe I have outputs this:
The message.data value stays at $205.00
The value never updates to $220.00
channel.publish( this.auctionId, this.currentBid);
channel.subscribe(this.auctionId, function (message) {
document.getElementById('currentBid').innerHTML = JSON.stringify(message.data);
});