State Management
All states of resources associated with a Call in the Graph Communications Calling SDK are handled internally.
- The notifications and events for a particular
ICall
or a particular resource contained inICall
are always received on a single application instance. This means that the instance should be maintaining the state of a call in memory and a singleICall
object exists throughout the duration of the call. These are called Stateful calls and the bots are called Stateful bots. - The notification or events for any call can hit any instance of the application. This means that everytime a notification comes to an instance, a new
Call
object is created by the Graph Communications Calling Core SDK and is destroyed once the notification/event has been handled. Any state required for the call should be maintained by the bot logic. These type of bots are called Stateless bots signifying that the Graph Communications Calling Core SDK itself does not maintain any state for the bot.
Differences Between Stateless and Stateful Bots
The major difference between Stateless and Stateful bots is that maintaining Stateful bots requires that the bot instance would not go down when a call is in progress. If the instance goes down, the call object is lost and no notifications or events are received by the Graph Communications Calling SDK and the calls gets dropped by the server. On the contrast, in Stateless bots, even if the bot instance goes down, the events and notifications go to the other instances of the bot and the bot can continue its logic.
Important
In Application Hosted Media Calls, the media is handled by a single instance of the bot. Therefore, all the notifications should reach the same instance of the bot for signaling of the media to be properly handled. Thus stateless scenarios for Application Hosted Media bots are not supported.