SS-RPC server
1 Features and limitations
2 Server API
register-method!
define-method
serve!
call
call!
on-terminate
server-readtable
7.7

SS-RPC server

Sergey Petrov <sekk1e@yandex.ru>

SS-RPC is a Synchronous S-expression-based Remote Procedure Call, facility to call procedure within remote process and receive return value. SS-RPC allows you to use Racket as GNU Emacs extension language. It includes a server described by this page and a client for Emacs.

1 Features and limitations

SS-RPC uses S-expressions as message language and TCP/IP as transport. Main advantages of SS-RPC over other RPCs for Emacs are lower remote call overhead and a feature of mutual remote call between server and client.

SS-RPC is limited with synchronous calls and transmitted data structures which are defined by the intersection of Emacs Lisp and Racket readers.

2 Server API

 (require ss-rpc-server) package: ss-rpc-server

procedure

(register-method! x key)  void?

  x : procedure?
  key : symbol?
Puts a procedure x to a method table that can be accessed from client by a key.

syntax

(define-method (id args) body ...+)

Syntactic wrapper for define with a registering as a method with its symbol.

> (define-method (echo x) x)

is a shorthand for
> (define (echo x) x)
> (register-method! echo 'echo)

procedure

(serve! [#:log-level log-level    
  #:log-out log-out])  void?
  log-level : (or/c 'none 'fatal 'error 'warning 'info 'debug)
   = 'info
  log-out : output-port? = (current-output-port)
Enters a serving loop with handling incoming commands.

procedure

(call method arg ...)  any/c

  method : symbol?
  arg : any/c
Applies a elisp procedure method to args as its arguments and returns the result of application. On elisp side ss-rpc does not registers remote procedures and method can be any elisp procedure symbol.

procedure

(call! method arg ...)  void?

  method : symbol?
  arg : any/c
Applies a elisp procedure method to args as its arguments with ignoring the return result of application. On elisp side ss-rpc does not registers remote procedures and method can be any elisp procedure symbol.

parameter

(on-terminate)  (-> any/c)

(on-terminate proc)  void?
  proc : (-> any/c)
 = void
Deinitialization procedure which will be applied on receiving terminate command.

parameter

(server-readtable)  readtable?

(server-readtable x)  void?
  x : readtable?
 = readtable?
Readtable to read incoming message. Currently reads nil symbol as empty list, elisp vectors and hashtables