-
Notifications
You must be signed in to change notification settings - Fork 38
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
Two-way communication with the Swift binary #2
Comments
I just thought of a possible solution. We could use So on the Swift side we would send a notification when the Swift binary actually started recording: DistributedNotificationCenter.default().postNotificationName(NSNotification.Name("aperture.recording"), object: nil, userInfo: ["file": url], deliverImmediately: true) And on the Electron-side we would listen for that event: electron.systemPreferences.subscribeNotification('aperture.recording', (event, userInfo) => {
console.log('event', event, userInfo);
}); Which would output the following from Electron:
This would work both ways. The downside is that we would need to write it specifically for Electron, so it would need to be a different mode/option in Aperture. Additional reading: https://academy.realm.io/posts/thomas-goyne-fast-inter-process-communication/ |
Yeah seems like a good solution to me, although I'm not too familiar with DistributedNotificationCenter or Electron.. |
@LarsJK Ah yeah, that's an interesting idea. I couldn't find a Node.js module for this, but shouldn't be too hard to create a simple one that interfaces |
Maybe XPC could be an alternative as well.. Haven't actually used any of these myself, so I don't know which one would be best.. |
Perhaps that lib could use the electron implementation if it's available (and thus we could release a v0 that only supports the electron implementation now)? 🤔 @sindresorhus But yes, that sounds like the best solution so far. |
We'll need two-way communication to be able to implement pause/resume recording (#28) and to fix #40. We need to use some kind of socket/IPC communication (wulkano/Aperture#8 (comment)).
The text was updated successfully, but these errors were encountered: