Created
June 18, 2022 15:35
-
-
Save mxblsdl/b3ed60d52c638229fddf9791cb1ce3d0 to your computer and use it in GitHub Desktop.
Example of callback function for when shiny closes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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