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
).
clientData |
A
|
input |
The session's |
isClosed() |
A function that returns |
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). |
allowReconnect(value) |
If |
sendCustomMessage(type, message) |
Sends a custom message to the web page. |
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 |
ns(id) |
Server-side version of |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.