Script Library: 1241 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: coccinelle

Documentation for: easy-soccer.r


Welcome in the world of Easy-Soccer, a broker over Internet written in Rebol.

Author:  Marco
e-mail:  mvri@bluewin.ch
Date:  July 10, 2004
Version:  1.0

Contents

1. Small introduction

Easy-Soccer is a broker written in Rebol with the goal to facilitate the writing and the deployment of client/server application written in Rebol.

Easy-Soccer uses a simple server HTTP and cgi to execute Rebol code on a server. It also makes it possible to repatriate automatically on the client, the client part part of code.

Easy-Soccer makes it possible to very easily expose function written in Rebol like services. Thus, you can use its functions as if they were defined locally. Easy-Soccer uses HTTP for the transport of the messages like SOAP or X-RPC. If you can read a Web page while making

  read http://your-URL

you can connect yourselves to services soccer.

2. On the side of the server

To serve as the overall defined functions is really easy. Do simply this:

  #! rebol -cs
  rebol [ ]
  do %easy-soccer.r
  serve [ now ]

3. the client part

To be able to use the distant services, it is simply necessary a do of the cgi server.

  rebol [ ]
  do http://your.marvellous.server/your-script.cgi
  print now

This repatriates a stub of the functions 'now on the client and carries out it.

The function repatriated can be put in a context thus making it possible to use several server without conflict

  rebol [ ]
  serveur1:  context load do next load http://your.marvellous.server/your-script.cgi
  serveur2:  context load do next load http://another.marvellous.server/another-script.cgi
  print [ "On server 1 it is" server1/now "whereas on server 2 it is" server2/now ]

It is not very beautyfull, but it works.

4. Mode of use

As indicated above, simple do HTTP:... or C %... then makes it possible to call upon the local or distant functions.

But easy-soccer allows much more than this and the mode of call is multiple. You find 2 samples below but there are other possibilities.

4.1 With the launching of Rebol

  rebol http://your.marvellous.server/your-script.cgi

or

  rebol your-script.cgi

4.2 In the plugin

  <OBJECT
     ID="rebol"
     CLASSID="CLSID:9DDFB297-9ED8-421d-B�C-37�0F36E6C5"
     CODEBASE="http://www.rebol.com/plugin/rebolb5.cab#Version=0,5,0,0 "
     WIDTH="800" HEIGHT="500 "
  >
  <PARAM NAME="LaunchURL" VALUE="your-script.cgi " >
  </OBJECT >

And in this case, if you open the file in the browser, the application is executed out in standalone,on the other hand if you open a URL then the application is executed as client/server.

4.3 Plugin Sample

A real estate application sample

The calendar sample

The rebodex sample

5. Compression and encryption

Easy-soccer makes it possible to compress and to encrypt the data circulating on the network. For this, refinements /encrypt and /compress are at disposal

To compress :

  serve/compress [ f1 f2 ] true;  compress the data (default option)
  serve/compress [ f1 f2 ] false;  do not compress the data

To encrypt :

  serve/encloak [ f1 f2 ] true;  encrypt the data
  serve/encloak [ f1 f2 ] false;  do not encrypt the data (default option)

NB The encryption is weak because the key is transmitted with the data.

6. advanced Options

Easy-soccer makes it possible to "serve" as the functions which are executed localy or remotely according to mode of call of script.

But it is possible to "serve" any other type of data (datatype) except the port!In this case, the value is simply returned to the client.

For example, it is possible to return an object, but attention,if these objects contain functions they are executed locally, never remotely.