May 2017
Intermediate to advanced
388 pages
7h 30m
English
In both the server and the client, we didn't provide an unsubscribing mechanism. For example, if you close the browser, the server will continue calling the newTime() function indefinitely.
Meteor.publish() provides some other useful APIs. When the client is subscribed for the first time, we can send a notification that the initial dataset was sent using this.ready(). This will call the onReady callback on the client.
We can also unsubscribe the client with this.stop() or listen whether the client subscription is stopped.
The publisher on the server:
Meteor.publish('time', function() { let self = this; self.added('time', id, time); // notify if record is added to the collection time let interval = Meteor.setInterval(function() ...Read now
Unlock full access