Websockets and Shiny Apps

434 views
Skip to first unread message

Christopher Wilson

unread,
Jan 28, 2016, 6:59:22 PM1/28/16
to Shiny - Web Framework for R
Is there any way to have a Shiny app that can be dynamically updated via an external websocket connection.  For example, if I have a device monitor that's pushing some counter over a websocket (or to a server that's exporting a websocket connection), is there any way to have a Shiny app connect to that websocket and update a plot?  I see httpuv websocket server, but not much in the way of clients out there.  Thoughts?

Thanks in advance.

-Chris

Joe Cheng

unread,
Jan 28, 2016, 9:39:53 PM1/28/16
to Christopher Wilson, Shiny - Web Framework for R
There's not currently a usable websocket client library. But how about serving your data over a plain TCP socket? I have an example of that here:
https://github.com/jcheng5/crandash/blob/master/global.R
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/36eafcbb-6638-40c6-82ca-5397178a287c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher Wilson

unread,
Jan 29, 2016, 9:40:28 AM1/29/16
to Shiny - Web Framework for R, wils...@gmail.com
Thank you, Joe.  I'll have a look at it.

BTW - I have a variety of data sources and have been looking at websocketd (http://websocketd.com/) as a way to quickly prototype fetching data using whatever means necessary (currently HBase/OpenTSDB and 40 lines of Python).  It'd be great if there was a clean way to update Shiny with a websocket library that supported TLS and decent level of auth.  If that ever gets prioritized happy to become a beta tester.

-Chris

Christopher Wilson

unread,
Aug 24, 2016, 9:07:20 PM8/24/16
to Shiny - Web Framework for R, wils...@gmail.com
I wanted to re-ask the question regarding connecting R/Shiny to a websocket?  I've looked at Plotly's streaming API, PubNub, Kafka, and a few others and would like to see if there is work happening in this area?  If so I'd like to help as a tester as I've got a few patterns that require this functionality.

If there's a way to wire up a websocket with JS and connect that to R I'm all ears.

BTW - I found socket approach a little brittle.

-Chris
Reply all
Reply to author
Forward
0 new messages