Because RxDB is able to broadcast the database state between browser tabs, having multiple renderer processes is not a problem like it would be when you use plain IndexedDB without RxDB. To start with RxDB, I would recommend to use the Dexie.js RxStorage in the renderer processes. However it is part of the □ Premium Plugins which must be purchased, so to try out RxDB with Electron, you might want to use one of the other options. It is recommended to use the SQLite RxStorage because it has the best performance and is the easiest to set up. The PouchDB RxStorage with the SQLite adapter mentioned above.The memory RxStorage that stores the data inside of the JavaScript memory without persistence. It has encryption and compression features and most important it has a battle tested replication protocol that can be used to do a realtime sync with your backend.īecause of the flexible storage layer of RxDB, there are many options on how to use it with Electron: For example it is able to subscribe to query results of single fields of document. It has many features that come in handy when RxDB is used with UI based applications like you Electron app. RxDB is a NoSQL database for JavaScript applications. Using these Web Storage APIs is generally only recommend when you know for sure that there will be always only one rendering process and performance is not that relevant. Localstorage and WebSQL are even slower by the way. Storing and querying much data might become your performance bottleneck. IndexedDB is slow mostly because it has to go through layers of browser security and abstractions. Each browser tab could modify the database state while the others do not know of the changes and keep an outdated UI.Īnother thing is performance. If you have more then one renderer process, it becomes hard to manage database writes between them. This is easy to setup and storing small sets of data can be achieved in a short span of time.īut as soon as your application goes beyond a simple TODO-app, there are multiple obstacles that come in your way. Localstorage / IndexedDB / WebSQL īecause Electron uses a common Chrome web browser in the renderer process, you can access the common Web Storage APIs like Localstorage, IndexedDB and WebSQL. Instead you should use a database that can be bundled and run inside of Electron, either in the main or in the renderer process. In practice this is not a viable way to go because shipping the correct binaries and opening ports is way to complicated and troublesome. In theory you could ship the correct database server binaries with your electron application and start a process on the clients device which exposes a port to the database that can be consumed by Electron. Server Side Databases īecause Electron runs on a desktop computer, you might think that it should be possible to use a common "server" database like MySQL, PostgreSQL or MongoDB. This is important to understand because choosing the right database depends on your use case and on which of these JavaScript runtimes you want to keep the data. Each renderer process represents one "browser tab".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |