Shiny server functions can optionally include session
as a parameter
(e.g. function(input, output, session)
). The session object is an
environment that can be used to access information and functionality
relating to the session. The following list describes the items available
in the environment; they can be accessed using the $
operator (for
example, session$clientData$url_search
).
allowReconnect(value) |
If |
clientData |
A
|
input |
The session's |
isClosed() |
A function that returns |
ns(id) |
Server-side version of |
onEnded(callback) |
Synonym for |
onFlush(func, once=TRUE) |
Registers a function to be called before the next time (if |
onFlushed(func, once=TRUE) |
Registers a function to be called after the next time (if |
onSessionEnded(callback) |
Registers a function to be called after the client has disconnected. Returns a function that can be called with no arguments to cancel the registration. |
output |
The session's |
reactlog |
For internal use. |
registerDataObj(name, data, filterFunc) |
Publishes any R object as a URL endpoint that is unique to this session.
|
reload() |
The equivalent of hitting the browser's Reload button. Only works if the session is actually connected. |
request |
An environment that implements the Rook specification for HTTP requests. This is the request that was used to initiate the websocket connection (as opposed to the request that downloaded the web page for the app). |
userData |
An environment for app authors and module/package authors to store whatever session-specific data they want. |
resetBrush(brushId) |
Resets/clears the brush with the given |
sendCustomMessage(type, message) |
Sends a custom message to the web page. |
sendBinaryMessage(type, message) |
Similar to |
sendInputMessage(inputId, message) |
Sends a message to an input on the session's client web page; if the input
is present and bound on the page at the time the message is received, then
the input binding object's |
setBookmarkExclude(names) |
Set input names to be excluded from bookmarking. |
getBookmarkExclude() |
Returns the set of input names to be excluded from bookmarking. |
onBookmark(fun) |
Registers a function that will be called just before bookmarking state. |
onBookmarked(fun) |
Registers a function that will be called just after bookmarking state. |
onRestore(fun) |
Registers a function that will be called when a session is restored, before all other reactives, observers, and render functions are run. |
onRestored(fun) |
Registers a function that will be called when a session is restored, after all other reactives, observers, and render functions are run. |
doBookmark() |
Do bookmarking and invoke the onBookmark and onBookmarked callback functions. |
exportTestValues() |
Registers expressions for export in test mode, available at the test snapshot URL. |
getTestSnapshotUrl(input=TRUE, output=TRUE, export=TRUE,
format="json") |
Returns a URL for the test snapshots. Only has an effect when the
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.