I have read this post and I don\'t know if it is a stupid question. I am completely newbie in reactive programming.
The question is very simple: supposing I have a f
There is a protocol on top of HTTP which allows delivery of a server response in smaller, ready-to-be-consumed, chunks to the browser using HTTP transport. It's called SSE (Server Sent Events) or EventSource, here is pretty thoroughly assembled article on the topic.
There are other means to stream data using the HTTP protocol. One such alternative is JSON streaming, in which you write partial responses on the wire from the server and consume the JSON chunks when they arrive. On the consuming side a popular library is called Oboe.js, on the server side you basically need to write the partial data on the response wire when you want to sent it, or when it's available.
For both approaches Rx is useful for handling the streaming logic on the server side. You model the pieces as a stream (handle errors, etc.) and eventually, in the Subscriber, you write the single emissions on the wire, closing the response when the Observable is finished.
On the client side, the EventSource events can be wrapped in a new Observable (via Rx.Observable.create()
) and processed further as a stream. Also Oboe.js events can be converted into Observables (via Rx.Observable.fromEvent()
.