|Did you know ...||Search Documentation:|
|Pack real -- examples/ws_hist/readme.txt|
As of Real 1.1, R can be used in Prolog servers by doing all the threading in Prolog. As of Real 1.3 R can be used on any thread, thanks to the good work of Samer Abdallah. Previously all R serving was done on the main thread, as: "Embedded R is is designed to be run in the main thread, and all the testing is done in that context" .
To test R in web services interactively, simply consult
and point your web browser to http://localhost:7171
Your R need to have ggplot2 package installed for the example to work.
To employ Real in a web server ran as a Unix service, you need to use
library(http_unix_daemon_real) instead of library(http/http_unix_daemon)
and start the server with --wait=real.
There is an example provided in pack(real/examples/ws_hist/).
You can test a server running this example at: http://stoics.org.uk:7171
The full sequence of setting up the daemon service is:
pack(real/examples/ws_hist/swipl-ws_hist)] to /etc/init.d/ (sudo)
pack(real/examples/ws_hist/ws_hist.pl)] to somewhere the above script can find
For more details look at pack(real/examples/ws_hist/). and http://stoics.org.uk/~nicos/sware/real/ws.html
As of version 1.1, Real auto-manages threading by intecepting calls to the interface predicates, <-/2 and <-/1. If the command to be passed to R is in a thread other than main, a message is send to thread main where the call will be served. Currently Real does not do any disambiguation between the callers, so it is of paramount importance that the user ensures the common R environment is sane and clean. A way to keep things tidy is to use http_session. Each session gets a unique ID which you can use to identify R variables.
http://stoics.org.uk/~nicos/sware/real/ Nicos Angelopoulos London, 2014-15