HTML5

R/Websockets Simple Plotting Example with flotr and JSON


               
Connection not initialized

Once connected, press the "Submit" button to request that your local R engine generate some random numbers. They will be displayed in a plot generated by flotr.

The 'rwebsockets' package is a simple and portable websockets implementation for the R language, based on the C 'libwebsockets' library. The rwebsockets package is especially well-suited to lightweight Javascript/R integration.

Some versions of Firefox ship with Websockets disabled by default. To enable them, see, for example, this link: http://techdows.com/2010/12/turn-on-websockets-in-firefox-4.html

HTML 5 websockets is a modern lightweight socket-like communication protocol. Although still in development, HTML 5 websockets is widely supported: most recent browsers support it and there are many high-quality langauge implementations. HTML 5 websockets let Javascript and other scripts embedded within web pages directly interact with R, bypassing traditional middleware layers like .NET, Java, and other web services, normally used for such interaction.

Note that, although this web page was loaded from http://illposed.net/rwebsockjson.html, the communication between Javascript and R is taking place entirely on the local system through HTML 5 Websockets.