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.

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.]
Arnold Schrijver Aug 6 '17 at 9:36 on 2017-08-06 09:36
source share