Resolve thread-unsafe issue
Upstream: https://github.com/arximboldi/lager/issues/118
Generally, things like Client
and Room
has well-defined behaviour only when the thread that calls Client functions and Room functions is the same as the thread that has the event loop.
Option 1: Just make the user always execute Client functions inside the event loop thread.
Option 2 (upstream resolution): Make a secondary root that update inside the thread with Client. In this case, we do not need to make another Promise handler. However, we will need to distinguish between the cursors the user provides (suitable only for synchronous functions, e.g. Client::serverUrl()
, Client::room()
), and the cursors suitable for asynchronous functions (to be used within the event loop thread, e.g. Client::syncForever()
).