rstudio/shiny — pull request #153 by jcheng5 (2013-04-22 23:33:27+00:00)
Title: Add callback for session end

With this change, you can now do

```
shinyServer(function(input, output, session) {
session$onSessionEnded(function() {
print("Session ended.")
})
})
```

The call to `onSessionEnded` returns a no-arg function that unregisters the callback when called.

Feedback especially welcome on the name `onSessionEnded`. I also considered `onClose`, `onClosed`, `onEnd`, `onEnded`, `onSessionEnd`. I went with the past-tense to emphasize that the session truly will be over by the time you're called back; there's no point in trying to send any message to the client, as it will have already disconnected.