Session object

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).


  • clientDataA reactiveValues object that contains information about the client.
    • allowDataUriSchemeis a logical value that indicates whether the browser is able to handle URIs that use thedata:scheme.
    pixelratio reports the "device pixel ratio" from the web browser, or 1 if none is reported. The value is 2 for Apple Retina displays. singletons - for internal use url_protocol, url_hostname, url_port, url_pathname, url_search, and url_hash_initial can be used to get the components of the URL that was requested by the browser to load the Shiny app page. These values are from the browser's perspective, so neither HTTP proxies nor Shiny Server will affect these values. The url_search value may be used with parseQueryString to access query string parameters.
  • clientData also contains information about each output. output_outputId_width and output_outputId_height give the dimensions (using offsetWidth and offsetHeight) of the DOM element that is bound to outputId, and output_outputId_hidden is a logical that indicates whether the element is hidden. These values may be NULL if the output is not bound.


  • input
  • isClosed()
  • onEnded(callback)
  • onFlush(func, once=TRUE)
  • onFlushed(func, once=TRUE)
  • onSessionEnded(callback)
  • output
  • reactlog
  • registerDataObj(name, data, filterFunc)
  • request
  • sendCustomMessage(type, message)
  • sendInputMessage(inputId, message)



  • session
Documentation reproduced from package shiny, version 0.12.2, License: GPL-3 | file LICENSE

Community examples

Looks like there are no examples yet.