But what I would like to do is something like:
ws$onMessage(function(event) {
result <- as.data.frame(fromJSON(event$data))
})
I know my connection works okay and when I write the result as csv inside the onMessage function, it works but the result object does not show in the environment.
What can be done to actually get the data frame from the call in the global environment?
is this in shiny ?
you would not typically use traditional global objects in shiny.
you would use some variety of reactive, maybe a reactivelist you could grow.
if you need to end the app and have the final result somewere, then you'd probably make a button (that you could press before quiting) to write your reactive object to disk (or potentially to the global environment maybe with an assign or <<- syntax