appy-one / acebase

A fast, low memory, transactional, index & query enabled NoSQL database engine and server for node.js and browser with realtime data change notifications
MIT License
481 stars 27 forks source link

Getting feature not supported error when attempting to run in Electron app #206

Closed csuwildcat closed 1 year ago

csuwildcat commented 1 year ago

I can only get Acebase to run in Electron if I use the AceBase.WithIndexedDB storage option, even though Electron has full Node.js access to the file system. Is there perhaps some feature detection code that is viewing Electron only as a browser, because it contains access to both IDB and the file system?

appy-one commented 1 year ago

Sounds like you are using AceBase on the UI (BrowserWindow) thread instead of in the main (Node.js) process. Move the AceBase code into your main process (or preload.js) to store data to your local file system.

csuwildcat commented 1 year ago

@appy-one yeah, got it going in that env, but it led to a follow-up question: do you know of any existing uses of AceBase in Electron that show the best way to leverage the storage residing in the main Node process from the render process? I suppose IPC messaging?

appy-one commented 1 year ago

I don't have any experience with this myself, but I reckon Electron's IPC is indeed the easiest way to pass data back and forth

appy-one commented 1 year ago

Maybe even better, this is what I would do: start a local acebase-server instance in your main process and use an acebase-client in your UI thread to connect to it!

csuwildcat commented 1 year ago

Thank you for the suggestion, I think the server route is likely to be the easiest, so I'll try that!