React Native to Go connection
- 1 Function calls
- 2 Events
- 3 Go to React Native Signals
- caller provides a callback
- check for availability of current Activity
- if available: call a static method on
ExecutorService(or sometimes a
Thread) and use its result as callback payload
- else: ivoke callback with false as payload
From RN perspective calls do not block, result is provided through callback execution.
StatusGo is a C library generated from go cade embeded in Status apps. On android it is packaged as a JNI
aar (generated using xgo).
StatusGo directly expose
status-go methods marked for exportation. Those methods are defined in cmd/statusd/library.go and marked as
go side calls are then dispatched to geth/api then geth/jail
Data is provided to the go layer as primitive types and retrieved RN side as
Go to React Native Signals
Intention of Signals
Signals allows the notification of status-react about asynchronously happening events in status-go. Normally during the interactive usage of the frontend it makes calls to the backend. Some of them get synchronous answers, others due to the nature of the technology can only answer later while the frontend shall not be locked. Here the status-go sends signals containing more detailed information about the event. Registered handlers in status-react receive and process these signals.
The following signals are currently in use.
transaction.queued is triggered when an incoming transaction is enqueued.
transaction.failed is triggered by the transaction response handler in case of an error.
node.started is triggered when the underlying node is started.
node.ready is triggered when the underlying node is fully ready. This considers the backend to be fully registered.
node.stopped is triggered when the underlying node is fully stopped.
node.crashed is triggered when the underlying node crashed.
chaindata.removed is triggered when the underlying node's chain data is removed.