This is VERY simple R function that when ran turns your R session into a websocket server. For this example it returns the standard deviation from a JSON encoded array sent via websockets.
This method can be used to do all sorts of things, include return information for the R workspace environment and even dynamically run code through the use of eval() on your global environment (not recommended for security reasons). If you want to respond with the workspace environment information simply swap out ws$send() with the following…
ws$send(toJSON(ls(envir = .GlobalEnv)))
Hope this is useful for someone. I will be putting together a much more involved tutorial sometime down the road that will cover dashboards outside the use of Shiny.