I m new in reactive programming and I m a bit lost reading all these articles that I can't understand.
Actually, I m a javascript developer from Nodejs, Angularjs, Angular 2 and React.
What I do
I use promises all the time, for remote data fetching, local async resolution etc... Better testability than callbacks and fit my needs.
What I understand using streams
I can't figure out where streams can save me except in a particular case.
This special case, is that I can't use promises while listening on streams because the promise would be resolved only once.
An example with SocketIo:
io.on('connection', (socket) => {
// this works
});
io.on('connection').then((socket) => {
// this can't work, promise would be resolved only once
});
If I m not wrong, I could use reactive streams to manage this case by simply returning an observable. Right ?
What I don't understand
I m studying Angular 2 and all the stuff around. Actually, from many blogs, people use to use observables to fetch remote data and I can't understand what could be an advantage of using it instead of promises.
The fact is that I would need to make a remote like in both cases, so why more one than the other ? Is this a performance issue ?
What I need
If you've read the whole question, what I need is to understand what are the advantages of using reactive programming instead of promises in the case of remote data fetching ?
In which (other cases) could it be better to use reactive stuff than usual stuff ?