Kill SDK
completely terminate the sdk kindlysdk kill() the kill() method completely terminates the sdk and clears all state this is more destructive than endchat() end chat md which only disconnects the chat session what kill() does when you call kill() , the sdk will ๐ disconnect the chat session (same as endchat() ) ๐งน clear all session data including messages and context โก reset sdk initialization state ๐ clear bot key and authentication ๐จ reset configuration and themes ๐ก emit termination events for cleanup after calling kill() after calling kill() , the sdk returns to an uninitialized state โ you cannot call displaychat() or other sdk methods โ
you must call start() again before using any sdk functions โ
all configuration (themes, permissions, etc ) needs to be set up again usage examples complete sdk shutdown // terminate the sdk completely kindlysdk kill() then { in print("โ
sdk completely terminated") // sdk is now in uninitialized state } catch { error in print("โ kill failed \\(error)") } switch to different bot (alternative method) // method 1 using kill() for explicit control kindlysdk kill() then { in // sdk is now uninitialized must call start() again kindlysdk start(botkey "new bot key", market "your market") kindlysdk displaychat() } // method 2 automatic switching (recommended) kindlysdk start(botkey "new bot key", market "your market") // sdk handles cleanup automatically kindlysdk displaychat() when to use kill() vs endchat() use kill() when ๐ app shutdown terminating the app or major state changes ๐ complete reset need to clear all sdk state and start fresh ๐ error recovery recovering from sdk errors or corruption ๐งช testing ensuring clean state between test runs use endchat() when ๐ฌ end conversation user finishes chatting but may return later ๐ temporary disconnect preserving sdk state for quick reconnection ๐ฏ normal flow standard chat lifecycle management comparison method session sdk state bot key config next action endchat() โ cleared โ
preserved โ
preserved โ
preserved displaychat() kill() โ cleared โ reset โ cleared โ reset start() required return value the kill() method returns a promise\<void> that resolves when the termination is complete kindlysdk kill() then { in // sdk termination completed successfully print("sdk killed successfully") } catch { error in // handle any cleanup errors print("kill error \\(error)") } best practices always wait for completion before calling start() again kindlysdk kill() then { in // safe to reinitialize now kindlysdk start(botkey "new bot", market "your market") } handle errors gracefully in case cleanup fails kindlysdk kill() catch { error in // log error but continue with app flow print("kill failed, but continuing \\(error)") } use automatic bot switching instead of manual kill/start when possible // preferred automatic cleanup kindlysdk start(botkey "new bot", market "your market") // instead of manual cleanup kindlysdk kill() then { in kindlysdk start(botkey "new bot", market "your market") } for normal chat lifecycle management, prefer endchat() end chat md over kill()