I'm trying to figure out how to make communicate 2 HTML/JS apps in a local network. The whole purpose is that app1 can fire JS events to app2, and vice versa without using Internet.
Both apps are on the same local network, but not running on the same host (for example: app1 is hosted on 192.168.0.12 and app2 on 192.68.0.13)
I heard about PostMessage to do such a thing, but all examples I saw dealed with 2 HTML pages on 1 host.
Can PostMessage do what I want to? Note that I'm using AngularJS.
Thanks!!
Yes that should be no problem. Typically you use an iframe and place app2 in app1, or as sibling iframes on another page. You can then send a massage from the iframe window (app2) to the top window (app1) by
And then you can listen to it from the app1 window:
Read much more about it here: Mozilla page about postMessage