Question: I've created multiple windows from Electron's main process and need to pass messages between them. The only way I know to send messages from rendererA to rendererB is by bouncing it to the main process. Is there any way to directly send a message from rendererA to renderB?

Answer: 
Basicly, in electron, communications between process has three forms:

1. main -> renderer: `webContents.fromId(id).send()` on sender side, `ipcRenderer.on` on receiver side
2. renderer -> main: `ipcRenderer.send()` on sender side, `ipcMain.on` on receiver side
3. renderer -> renderer: `ipcRenderer.sendTo()` on sender side, `ipcRenderer.on` on receiver side

So in renderer to renderer scenario, sender must know the destination's webContents.id, then call it to/from via `ipcRenderer.sendTo()`

---

I've made a electron ipc framework, [electron-ipcfy](https://github.com/vivimice/electron-ipcfy), which unifies ipc calls in all three scenario above.

```
import { ipcfy } from "electron-ipcfy";

interface TestService {
    greet(name: string);
}

const testService = ipcfy<TestService>('test');

if (process.type == 'browser') {
    // Attach implementation
    testService.__attachImpl(
        new class implements TestService {
            greet(name: string) {
                console.log(`Hello, ${name}!`);
            }
        });
}

// Then you can call it in any process
testService.greet('world');

```
It depends from the logic of your communication system.

For example, if you always have to send data from BrowserWindow2 to BrowserWindow4, you can declare the **ipcMain** in the BrowserWindow4 and **ipcRenderer** in the BrowserWindow2.

In case you have to send from all the BrowserWindows to all the others, I advice you to use Main process and dispatch message to the BrowserWindows (using the relatives **ID**) 

In your **message receiver**:

```
ipcMain.on('asynchronous-message', (event, arg) => {
   //manage data
}

```

And in your **message sender**:

```
ipcRenderer.send('asynchronous-message', message)

```

[ipcMain doc](https://github.com/electron/electron/blob/master/docs/api/ipc-main.md)

[ipcRenderer doc](https://github.com/electron/electron/blob/master/docs/api/ipc-renderer.md)