RPC Call

Synopsis

call [OPTIONS] SERVER-URI/METHOD([ARGUMENT])

Description

Call METHOD of the RSB RPC server at SERVER-URI with argument ARGUMENT and print the result to standard output, if any.

SERVER-URI designates the root scope of the remote server and the transport that should be used.

Tip

For details regarding the URI syntax involved in transport and channel specifications, see URIs.

ARGUMENT is treated as follows:

  • If ARGUMENT is the empty string, i.e. the call specification is of the form SERVER-URI/METHOD(), the METHOD is called without argument.
  • As the respective Boolean value when equal to true or false
  • As string when surrounded with double-quotes (")
  • As integer number when consisting of digits without decimal point
  • As float number when consisting of digits with decimal point
  • If ARGUMENT is the single character - or the string -:binary, the entire “contents” of standard input (until end of file) is read as a string or octet-vector respectively and used as argument for the method call.
  • If ARGUMENT is of one of the forms #P"PATHNAME", #P"PATHNAME":ENCODING or #P"PATHNAME":binary, the file designated by PATHNAME is read into a string (optionally employing ENCODING) or octet-vector and used as argument for the method call.

Note

When written as part of a shell command, some of the above forms may require protection from processing by the shell, usually by surrounding the form in single quotes (‘). For example:

$ call 'socket:/foobar/()'            # empty argument
$ call 'socket:/foo/bar(#P"my-file")' # read argument from my-file

The usual commandline options are accepted. Specialized commandline options:

--timeout SPEC, -t SPEC

If the result of the method call does not arrive within the amount of time specified by SPEC, consider the call to have failed and exit with non-zero status.

--no-wait

Do not wait for the result of the method call. Immediately return with zero status without printing a result to standard output.

Examples

  • $ call 'spread:/mycomponent/control/status()'
    "running" # prints return value, if any
    $ call 'spread:/mycomponent/control/terminate()'
    $ # returns once the method call completes
    

    In the above example, the call tool is used to invoke the status and terminate methods of the remote server at scope /mycomponent/control without an argument.

  • $ cat my-data.txt | call 'socket:/printer/print(-)'
    $ cat my-data.txt | call 'socket:/printer/print(-:binary)'
    $ call 'socket:/printer/print(#P"my-data.txt")'
    $ call 'socket:/printer/print(#P"my-data.txt":latin-1)'
    $ call 'socket:/printer/print(#P"my-data.txt":binary)'
    

    Two ways of using the content of the file my-data.txt as argument in a call of the print method on the scope /printer. The call uses the socket transport (with its default configuration). This form can only be used for sending string payloads.

    Note

    Note the use of single quotes (') to prevent elements of the pathname #"Pmy-data.txt" from being processed by the shell.

Implementations

Implementation Language Project Repository Link
Common Lisp rsb-tools-cl “0.11” branch of https://code.cor-lab.org/git/rsb.git.tools-cl