Pull vs Push system
Both are different methodology that tells how a data Producer can communicate with a data Consumer.
Pull system:
In pull system the consumer asks for the data from the producer whenever requires.
The function is example of a pull system —
The other example of pull system is generator function in JavaScript —
Generator is iterator form of pull system and in this consumer asks for the data from the producer and it can send data n number of times.
Push system:
In push system the producer determines when to send the data to the consumer.
The Promise is the example of push system —
Here, even the producer generating data multiple times using setInterval, but consumer receives only once.
The other type of push system is Observable —
Above example taken from Ben Lesh’s blog — Learning Observable By Building Observable.
In case of observable producer can send the data to the consumer n number of times and consumer will have ability to stop receiving data from producer anytime.