| Session {jrc} | R Documentation |
Session class
Description
Objects of this class handle all the incoming and outgoing messages for one active connection.
Please, avoid creating instances of this class manually. Each Session object is created when
a WebSocket is opened and serves as a wrapper around it. A manually created object will not have
a WebSocket connection and thus are not functional.
All sessions are stored within an object of class App and cannot exist and function without it.
One can manipulate a session directly, using its methods described below, via methods of the corresponding
App object or the provided wrapper function (links to them can be found in the Methods section).
Fields
id-
Automatically generated ID for this session. ID is a random combination of 6 letters or numbers. Please, do not change the value of this field.
lastActive-
Time of the last received message from the session's WebSocket. The timestamp is generated by the
Sys.timefunction. startTime-
Time when this session has been started (generated by the
Sys.timefunction).
Methods
getMessageIds()-
Returns IDs of all currently stored messages. ID is a combination of 6 random letters and numbers generated when the message is stored. See also
getMessageIds. authorize(messageId = NULL, show = FALSE)-
Authorizes evaluation of a message. Check
authorizefor more information. removeMessage(messageId = NULL)-
Removes a stored message. This can also be done with the
authorizefunction (setshow = TRUEand then select the “Ignore message” option). See alsoremoveMessage. sendCommand(command, wait = 0)-
Sends a JavaScript command to be evaluated on the web page. Check
sendCommandfor more information. callFunction(name, arguments = NULL, assignTo = NULL, wait = 0, thisArg = NULL, ...)-
Calls an existing JavaScript function on the web page. Check
callFunctionfor more information. sendData(variableName, variable, wait = 0, keepAsVector = FALSE, rowwise = TRUE)-
Sends data and assigns it to a variable on the web page. Check
sendDatafor more information. sendHTML(html, wait = 0)-
Sends HTML code that will be appended to the web page. Check
sendHTMLfor more information. sessionVariables(vars = NULL, varName = NULL, remove = NULL)-
Sets or returns variables that are used (read or modified) only by this session. If both arguments are
NULL, returns environment for this session. Ifvarsis a named list, adds this variables to the session environment. IfvarNameis a character, returns a variable with this name how it is seen from the session. If the variable doesn't exist, throws an error. Ifremoveis a vector of characters, removes variables with these names from the session environment. One can add variables to the session environment, get one back and remove variables with a single function call. ChecksetSessionVariables,getSessionVariable,removeSessionVariablesfor more information. setLimits(limits)-
Sets limits for memory usage, number of simultaneously active connections and amount of messages processed per second. For information about possible arguments, please, check
setLimits. This method accepts all the same arguments, but they should be supplied in a form of list.
Note, that Session class has some other public methods that are not mentioned in this list. These methods are
intended to be used only by other functions of jrc package and therefore are not documented.