Combining React Native and NodeJS in a single-user Android client application using Realm DB

I am studying NodeJS Compilation as a native Android library in the combined version of React Native + NodeJS + Realm.io rich client implementation (i.e. everything works on Android). I will use the react-native-node adaptation.

The NodeJS application runs as a Service and is associated with complex peer-to-peer data streaming. React Native is used in the main user interface service application.

enter image description here

I needed a good way to bridge the connection between the application and the service, and thought of a setup similar to CQRS, where:

  • The node service stores events (messages and data received from the network) in the db area. This is the write side of write.
  • the RN application reads data representations from the db area for use in the user interface. The 'read' side.
  • UI actions run commands that are sent to the node service
  • incoming commands in the node service are processed and lead to the saving of new events

In this project, RN and NodeJS applications connect to the same db area. I don’t know if this is possible. Perhaps realm should run in a separate service (if that is not already).

But given that the RN application lives in the foreground UI thread and in the NodeJS application in the background service thread, docs in Threading Realm Java state:

[...] Realm simplifies working with data across multiple threads without worrying about consistency or performance, as objects and queries are constantly updated.

You can work with live objects in different threads, read and write to them, without worrying about what other threads do with the same objects. If you need to change data, you can use a transaction. Other objects in other threads will be updated in the near real time (updates will be scheduled as an event on Looper, so Looper threads will be updated immediately after the event is processed).

The only limitation is that you cannot randomly transfer Realm objects between threads.

[... for example] When the background service adds new clients to Realm, the list of clients is automatically updated in the user interface without any additional intervention on your part.

I don't know if this works the same for realm-javascript , but suppose it does.

Questions

  • Is this a workable project?
  • What should I know in terms of support for Realm streaming?

[ Update : Asked a question about using NodeJS from Realm on Android in relation to this.]

0
android architecture react-native realm
Aug 6 '17 at 9:36 on
source share

No one has answered this question yet.

See similar questions:

fourteen
Viable Opportunities to Launch NodeJS on Android (August 2017)
2
Is it possible to run Node fs.readFileSync () in React Native?

or similar:

376
Handler vs AsyncTask vs Thread
6
Is there a way to pre-create a Realm database (default.Realm) via React-Native (JS)
3
How to quickly insert JSON into a Realm database for a React Native application
2
Realm React-Native: access to the same realm from JS (edit your own code) and android (java)
one
The real structure of the project
one
Respond to automatically updating your own kingdom
0
Realm React Native ListView Does Not Update
0
Real Real Real Data is not saved
0
Using a joint Realm db between Android source code and React Native in the same Android application
0
Cannot open synchronized kingdom on Android using React Native



All Articles