app_exit <- function(session, db) {
session$onSessionEnded(function() {
stopApp()
message("killing R process on exit")
if(is.null(db)){return()}else{RMySQL::dbDisconnect(db)}
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.