How do I share data between apps?

0 favourites
  • 9 posts
  • I have created two separate apps. They both use NodeWebKit to create a .exe for use on Windows computers.

    I would like to be able to share data between the two apps. Instead of combining the two apps I think it would be easier to simply output data from one and read it with the other...

    I would also like it to be fast enough that I can create triggers in one app and have them picked up in the other app.

    App 1: press button to set (webstorage?) variable to 0 or 1

    App 2: while variable is 0 do A, while variable is 1 do B

    Is there a way to do this? Through JSON or AJAX or Webstorage or something? I need to pass a trigger and a number but if I can pass one I can figure out the other...

    Both apps are running at the same time on the same computer... Is Webstorage Local or Session available as the same thing between both apps or does each app create its own instance and you can't share the data?


  • Maybe it's somehow possible to do with file chooser and dictionary, download the json string of what you want from first app to your device, then with file chooser you open it in other app, i don't know if it's gonna work and i didn't try this.

  • R0J0hound suggested using the clipboard in a different thread. Maybe you could try that depending what data you need to share.

    Edit: I just noticed this is an older version of your other thread. I guess you have it sorted now.

  • Export your first project for nw, any others would be exported as html5 (this is because you can't run nw.exe twice)

    From your first project you are able to open a new window (Assuming you know a little js)

    From the new window you can communicate back to the opening window with window.opener

    I've been working on an addon that does this and a fair bit more, it's not ready for public release but if this is a paid job give me a PM and I could have something for you the same day most likley.

  • I am running two NW.exe one called ColorPage.exe and one called ButtonPage.exe

    Using a suggestion from R0J0hound I have managed to get this to work using the Clipboard.

    You may be correct in that the websocket/ issues I am having are because I am running two NW apps at the same time but I have a node.js programmer working with me now to figure that all out.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry I misunderstood, I thought you wanted to run two games from the same nodewebkit export, in which case you can indeed mix two games but only one can be exported for nw

    This allows for two way communication without websockets or multiplayer, but it's slow...

    If you aren't trying to sync anything frame rate dependent I guess it doesn't matter though

  • Interesting... good to know for the future! For the project I am on I am only trying to send a trigger message which can delay even up to a full 1 second and the user experience won't suffer. Thanks for giving me something new to look into after this project is complete! (if it ever completes... ugh)

  • Did you try saving and loading simple text files?

  • I wanted to avoid using anything that specifically wrote files because of how long this app is going to be running. I don't know if the clipboard uses a drive based cache or not. This app will potentially run 24/7 for ... years? Not sure what they will do with it once I hand it off. If I can keep these messages from stressing the hard drive more than just normal operation that would be ideal. I am still working on the websocket solution as this would give me incredible flexibility to do all kinds of interfacing and communication with lots of stuff outside of C2 and my apps. The use of the clipboard is a great temporary fix for this, and will likely get me through my demo with flying colors, but getting the websocket working is really the ideal situation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)