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
Communicate between two windows #991
Comments
I need to be able to do complex communications like this in Window 1:
And in Window 2:
So this might call I've seen this: https://github.com/atom/atom-shell/blob/master/docs/api/ipc-browser.md But how would I do the same thing using IPC? As both of those chunks of code live inside the individual browser html pages and not in server-side JS. |
In your browser-code (what you call "server-side") you hold references to your BrowserWindows. |
Okay so from my understanding, this is how I would do it: index1.html
index2.html
But the code is inside the BrowserWindow HTML pages... and I haven't got anything in the server-side bit (e.g. the main.js) regarding the ipc... Is that correct? If not, what additional code do I need at the server-side to handle this? |
No, you send your |
Sorry, forgot to mention that you send from Browser to Renderer with |
So I need a combination of both to do what I want? If possible, it'd be awesome to see an example of what needs to go in |
yes. Very simple example: main.js
index1.html
index2.html
|
Don't use |
I created a Gist for you at https://gist.github.com/bwin/5ed15cc0620a6a63f081 |
@bwin I've got it working :) Your typo threw me but it's all working now. Thanks. |
👍 |
Why there is no direct communication ? It could be more simple to write, right? |
@Altiano There is. You just need to make sure that it comes from where the process was spawned. |
I mean from a renderer process to another one.. How.? |
|
this probably work, but how can you be sure that |
After some test, this is what I do:
|
That works but replying to the sender does not. In other words
In window 1
I've implemented a probaby crappy solution here but that was before I found this thread so I'm wondering if there is a simpler solution |
Just FYI, I pushed a major change to other-window-ipc. The new one uses channels which makes certain uses much easier. A channel listens for connections. Each channel can have multiple streams. |
What wrong with: main any js file in project does not work? |
How can I communicate between two BrowserWindows in atom-shell?
I have been using Intercom.js https://github.com/diy/intercom.js/ for a project which works fine in the browser world, but doesn't work in the atom-shell world... Any ideas for how to get Intercom.js working? Or an alternative?
The text was updated successfully, but these errors were encountered: