Pull vs Push system

Dhruv Patel
1 min readMay 16, 2018

--

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 —

Function

The other example of pull system is generator function in JavaScript —

Generator

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

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.

--

--

No responses yet