Can RxJS Observables perform inter-process communi

2019-08-29 15:14发布

问题:

For an Electron app, I was wondering, if we could instead of using the remote module to communicate between different Renderer Processes, use Observables.

I have read that Renderer Processes and the Main process are completely different which would, the way I understand, restrict the usage of Observables.

I am also not completely aware of the details of an Observable. So please, go easy on me :P

回答1:

Per comment, I think there are some misreadings what Observable can do vs. can't do. Observable allows you to handle various asynchronous time-series event in a specific manner. Electron's remote module is entirely different, it aims to expose some of proxy object between processes in Electron.

For handling IPC's messages via observable, you could easily create event bindngs like fromEvent(IPCxxx, 'channel') //chain operator as you need but it doesn't gets rid of necessary of IPC itself, as it is essential to use any kind of ipc mechanism between processes in Electron - just matter of which mechanism you'll choose for.