-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sendToRenderers
acts differently than callRenderer
#26
Comments
This behavior is intentional. It's meant as a broadcaster, not a two-way communication channel. Its docs doesn't mention any support for replying.
Not really clear what you mean. "Unchanged channel"?
Same here. Not clear what you mean. It could in theory support replying and receive an array of replies, but there are certain things that needs to be decided. Like, what if a renderer sends a rejected promise, should it throw or first wait for all renderers to send their response. I imagine it would also be some overhead of having to wait for all the renderers to respond. Electron IPC is not cheap. |
I thought it was a bug when I couldn't receive message from sendToRenderers by answerMain. |
I know this is an old issue, however is there a way to listen to sendToRenders within electron-better-ipc directly? |
Ohh now I understand. For the last 4 years, I thought |
From documentation I expected that these two functions act the same. Only expected difference was
callRenderer
sending to specific window andsendToRenderers
sending toBrowserWindow.getAllWindows()
.After digging deeper I found that
sendToRenderers
does not use the same channel formatting as the other method, so it is impossible to handle incoming messages usingipcRenderer.answerMain
.I have two possible solutions:
ipcRenderer
to handle unchanged channel.sendToRenderers
for every window.@sindresorhus which one would you prefer?
The text was updated successfully, but these errors were encountered: