jcubic / gaiman

Gaiman: Text based game engine and programming language
https://gaiman.js.org
GNU General Public License v3.0
138 stars 11 forks source link

Add JSON-RPC support #69

Open jcubic opened 2 years ago

jcubic commented 2 years ago

Server echo REPL

let service = rpc "/something.php"
while true
   echo service.echo(ask "?")
end
jcubic commented 2 years ago

Without Open-RPC the service object should be a proxy. Maybe Open-RPC is not needed at all.

jcubic commented 2 years ago

TODO: test with:

import Object

let service = rpc* "https://...."
config {"completion" => Object.keys(service)}
while true do
   let cmd = parse ask "rpc> "
   let ret = service[cmd.name](*cmd.args)
   if ret.error then
      echo "<red>" + ret.error + "</red>"
   else
      echo ret.result
   end
end