Skip to content

rn_bridge blocked nodejs mobile event processing #209

@microcai

Description

@microcai

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions