-
Notifications
You must be signed in to change notification settings - Fork 22
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
handleIPCMessage only sends replies to electron main frame #145
Comments
Just confirmed that the PR resolves the issue and my frames now successfully communicate! 🎉 It might be worth following up this issue by adding an example to the repo using iframes. |
Just giving this a friendly bump @jsonnull . Would love to see this merged as I think it blocks multi-window support as well. Also more than happy to help on any other roadmap items. This is by far the best way to work with electron ipc communication. |
Hey, thanks for the friendly bump and all the effort here. I'll get this merged in and get a release out. If you're interested in contributing more, let's chat sometime! |
This fix is released in |
Summary
I have a use case that involves using
iframes
and tRPC to communicate between each frame and the main thread. After spending some time debugging it seems thathandleIPCMessage
replies to the sender usingevent.sender.send
which will always reply to the main frame.References
Electron Docs
handleIPCMessage code
Solution
I think the solution here is pretty simple.
handleIPCMessage
should be able to useevent.reply
to respond to incoming events as stated by the Electron docs. This would also involve updating the types on theevent
parameters to useipcMainEvent
instead ofIpcMainInvokeEvent
.Example
Current implementation
Suggested change
Contributing
Would be more than happy to make a PR with the suggested changes above.
Versions
The text was updated successfully, but these errors were encountered: