Git Product home page Git Product logo

Comments (11)

rafaelcorreiapoli avatar rafaelcorreiapoli commented on August 29, 2024

Using node_integration:true, ipc works
At the same time I'm getting a lot of errors on Electron's the console:
Uncaught Error: Cannot find module 'jquery'
aldeed_simple-schema.js:2112 Uncaught TypeError: S is not a function

from electrify.

arboleya avatar arboleya commented on August 29, 2024

Thats a good issue. It's on my (unshared) roadmap.

Just to keep it clear:

Meteor's server runs independently from Electron.
Electron is a process which uses its own distribution of nodejs.
Meteor does it as well.
Meteor runs standalone as well as Electron.
So they are both individual process.
Electron is just used to open up the meteor's app url.

There's no open channel of comunication between Meteor and Electron.

At this point, I thought about a fast solution which consistis of adding kinda of a socket channel between meteor's server and electron code. It'll require some boilerplate for every call, like an api, but you can do this today.

Anyway, something like IPC will be ideal for this case, but I'm not sure how to proceed about linking the two processes altogether.

However the meteor's server runs in a child_process started by electron. Perhaps there can be some communication throughout the channels there are already available for this communication to happen.

Ideally, there will be a transparent bridge where you could access electron like a scope:

Meteor.startup(function(){
    Electrify.<the-whole-electron-api-here>.method([whatever], ...)
});

Makes sense? What do you think?

from electrify.

green-coder avatar green-coder commented on August 29, 2024

Hi, I would like my client app to browse the client's local file system and access its file's content. I am a beginner with Meteor and Electron so I can be wrong, but I believe that this can only be possible if there is a way for the Meteor process to call the fs API via the Electron process. Am I correct?

A socket between the 2 processes is still the recommended way?

from electrify.

arboleya avatar arboleya commented on August 29, 2024

@green-coder Yes, the socket is the way to go, and it'll be available in the upcoming 2.0.0 - I should release it this week.

Stay tuned.

from electrify.

arboleya avatar arboleya commented on August 29, 2024

@green-coder Another point, not sure what you're doing but you should be able to use NodeJS fs module through Npm.require('fs') on your Meteor's server code. It's a pure NodeJS thing, and should work without any surprises.

from electrify.

green-coder avatar green-coder commented on August 29, 2024

I am trying to write a software similar to SVN, client and server, using Meteor. My problem is on the client side (e.g. similar to Tortoise SVN) where I want to do operations like check-in / check-out / lock / unlock / watch files, as Meteor was not designed with this kind of usage for the client side.

I am counting on Electron to help me having a client which allow me native access to the file (like what Atom does with my files) but for the moment I am trapped inside Meteor's client environment ... so close to Electron's NodeJS but at the same time so far.

from electrify.

arboleya avatar arboleya commented on August 29, 2024

Not sure if Meteor is your best bet then, perhaps you can move along with pure Electron + js/css/etc?

In the upcoming Electrify version, however, you'll be able to invoke Electron methods from Meteor, both client and server. Even though, the back-and-forth information overhead could be an obstacle, since you'll still have to code both ends -- pretty much the same way you use Meteor.methods on the server code and Meteor.call from the client code.

from electrify.

green-coder avatar green-coder commented on August 29, 2024

From my point of view, Meteor is the best suited to my small time budget, it provides so much advantages for client-server synchronizations, and I would not be able to do this program without as I am still a beginner with web technologies.

from electrify.

arboleya avatar arboleya commented on August 29, 2024

Fine, expanding my explanation then, some infos that could help you.

  1. There will be a Electrify.methods({...}) in the electron code (inside .electrify folder). Remember that everything you put inside this folder, will HAVE access to all Electron API, so you can define methods here that does this and that.
  2. Then you will be able to call these methods from Meteor, using Electrify.call(...), from both client and server.
  3. The bridge that glues everything is done over Socket, as mentioned. It'll be transparently and will run always asynchronously.

Finally, just one more time, perhaps an even more straightforward way is for you to simply define methods on your Meteor's server code, and call them from the client code.

Remember that the server code does have access to filesystem, as I said before, using Npm.require('fs') and so on.

Hope this can give you a clear idea of how you can accomplish what you're looking for.

from electrify.

green-coder avatar green-coder commented on August 29, 2024

😃 that sounds really great.

For the 3., it would be nice to avoid binding the socket to a port, to make sure that only the 2 processes (Electron process + its child Meteor process) are using it.

I will start to write the server code and the client, and will count on your release for the last steps. Thank you a lot for your project.

from electrify.

arboleya avatar arboleya commented on August 29, 2024

Implemented in 2.0.0 - check out the new API / usage in project README.

from electrify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.