End Chat
disconnect the chat ends the chat and disconnects the sdk clears the context as well kindlysdk endchat() important the endchat() method now preserves the sdk initialization state this means â
the sdk remains initialized and ready for use â
you can call launchchat() again without needing to call start() â
bot key, authentication, and configuration are preserved â
only the active chat session and context are cleared if you need to completely terminate the sdk , use kill() kill sdk md instead bot switching workflows when switching between different bots, you have two workflow options option 1 automatic switching (recommended) the sdk automatically handles cleanup when you switch bot keys // current bot kindlysdk start(application = this, botkey = "bot 1", market = "your market") kindlysdk launchchat(context = this) // switch to different bot no explicit endchat() needed kindlysdk start(application = this, botkey = "bot 2", market = "your market") // sdk handles cleanup internally kindlysdk launchchat(context = this) option 2 explicit end then start for explicit control over the chat lifecycle // end current chat first kindlysdk endchat() // endchat() completes synchronously, so you can immediately proceed kindlysdk start(application = this, botkey = "new bot key", market = "your market") kindlysdk launchchat(context = this) both approaches work identically the sdk ensures proper cleanup and reinitialization in both cases when to use endchat() use endchat() explicitly when you want to disconnect completely stop the chat service without switching to another bot clear session data ensure all messages and context are cleared explicit lifecycle control have fine grained control over connection timing the endchat() method completes synchronously, ensuring all cleanup is finished before returning