Skip to content

Instantly share code, notes, and snippets.

@mxblsdl
Created June 18, 2022 15:35
Show Gist options
  • Save mxblsdl/b3ed60d52c638229fddf9791cb1ce3d0 to your computer and use it in GitHub Desktop.
Save mxblsdl/b3ed60d52c638229fddf9791cb1ce3d0 to your computer and use it in GitHub Desktop.
Example of callback function for when shiny closes
# Close connection to database when app closes
cancel.onSessionEnded <- session$onSessionEnded(function() {
if(exists("con")){
dbDisconnect(con)
print("Connection to DB Closed")
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment