Incorporating https://github.com/ably/ably-js into my project allowed me to utilize typescript effectively. Presently, my code updates the currentBid information in the mongodb document alongside the respective auctionId. The goal is to link the auctionId with the correct currentBid value using ABLY. To achieve this, I assigned the channel name to the auctionId with the currentBid value as the data input. Below is the snippet of my code. Upon execution, the message 'publish succeeded' appears in the ably Your app statistics summary and registers the message counter accordingly.
Upon bidding on the channel.subscribe, the innerHTML displays a JSON object on the screen. My challenge lies in associating the correct auctionId. How can I query the channels I am publishing?
The innerHTML output is as follows: If the currentBid stands at $205.00 and I place a bid of $15.00, the channel.subscribe function outputs:
The message.data value remains at $205.00
The value does not update to $220.00
channel.publish( this.auctionId, this.currentBid);
channel.subscribe(this.auctionId, function (message) {
document.getElementById('currentBid').innerHTML = JSON.stringify(message.data);
});