Function: remoteFunction

CALL:

remoteFunction(event, allowedFunctions, varargin)

DESCRIPTION:

generate remote function that can be called by the client of modelit.web.server.Server

INPUT:

    url: <string> or <modelit.web.client.HttpRequest>
      url of server, or HttpRequest that points to server
    fp: <function pointer>, or <function name>
      function pointer of function name.
varargin cell array
Cell array with name-value pairs that define additional attributes
for HttpRequest. Acceptable attributes (see also
modelit.web.client.HttpRequest).

OUTPUT:

fp_remote function pointer
function that can be called in the local context, but will execute server side.

EXAMPLE:

    Start two Matlab sessions.
 
    Execute in session #1: (start server with the permission to execute "sort")
      server = modelit.web.server.Server('localhost', 4444, remoteCallback('sort') ).start;
 
    Execute in session #2: (call remote function from client)
      Create and call a remote function. See "help remoteFunction" for
      specifying additional parameters like credentials, connection timeout
      and and response timnout are acceptable. 
  
      fp= remoteFunction('http://localhost:4444',@sort)
      [a,b] = fp(10:-1:1 )