Using Real in web servers.

As of Real 1.1, R can be used in Prolog web servers by doing all the threading in Prolog.
In particular, all the R serving in done 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" [1].
The good news is that Prolog web servers do very little on the main thread. To test R in web services interactively, simply consult

	?- [pack('real/examples/ws_hist/ws_hist.pl')].
and point your web browser to http://localhost:7171

Your R needs to have ggplot2 package installed for the example to work.
To employ Real in a web server ran as a Unix service, 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/swipl-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:

For more details look at pack(real/examples/ws_hist/).

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
sent 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.

[1] Threding-issues

---
March 2014