ionorg / ion-sdk-js

ion javascript sdk
MIT License
102 stars 70 forks source link

Add `onapiready` handler #182

Closed kevinmcconnell closed 3 years ago

kevinmcconnell commented 3 years ago

When joining a room there will be a brief period before the Subscriber API data channel is established. Methods that use the API during that time will fail silently. This can be a source of race conditions for code that needs to set the initial state of streams immediately after joining.

This change adds an onapiready handler that will be called once the data channel is established, which provides a way to avoid such race conditions.

tarrencev commented 3 years ago

+1 for resolving a join promise on connect

kevinmcconnell commented 3 years ago

Ah, yeah that's a much better idea :+1: I'll try that instead.

billylindeman commented 3 years ago

@kevinmcconnell awesome!