forked from nodejs/node-chakracore
-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
problem:
when dealing with async api, rn_bridge blocked node async event system, the Promise.then only gets called when you call channel.send() at android side next time.
way to reproduce:
android side:
channel.send( 'someevent1')
nodejs mobile side:
rn_bridge.channel.on('someevent1', (msg)=>{
some_async_api_that_returns_a_promise().then(
rn_bridge.channel.send('api-result'); // this never get called unless android calls channel.send some time later .....
)
})
since rn_bridge did not response a message immediately, the entire nodejs mobile thread got blocked, thus the promise is then blocked.
after android side calls channel.send again ( with what ever message ) the nodejs mobile thread runs again and dispatches the Promise.
Reactions are currently unavailable