1

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

Frixoe
  • 75
  • 10
  • I'm bit confused about q, Observable itself runs on js context so it doesn't have power to reach another processes directly. If q is ipc can be wrapped into observables, answer is yes that's way I'm using in my codebases, but reading q it sounds like you're thinking somewhat different. Would you elaborate bit more exact intention of question? – OJ Kwon Jan 29 '18 at 20:44
  • @OJKwon As I’m pretty sure you know that, we can use the remote module as an added level of abstraction over the IPCRenderer for inter-process communication. I was wondering if we could instead use an Observable to achieve the same behavior. Also, could you expand on how you used Observables to wrap the ipc in you codebase? – Frixoe Jan 29 '18 at 20:59

1 Answers1

2

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.

OJ Kwon
  • 4,385
  • 1
  • 20
  • 24