Re: Announce: glib-jsonrpc



It would be nice to compare and perhaps merge the two projects. Any
chance of you putting it up on a git repo?

Regarding async commands, my glib server does support it through the
glib_jsonrcp_register_async_command(). There is an example in
test-glib-jsonrcp-server as follows:

     glib_jsonrpc_server_register_async_command(server,
                                             "async_ping",
                                             cmd_async_ping,
                                             NULL);

and then in cmd_async_ping:


  int cmd_async_ping(GLibJsonRpcServer *server,
                     const char *method,
                     JsonNode *params,
                     gpointer user_data)
  {
    g_timeout_add_seconds(2, async_pong, server);

    return 0;
  }

  gboolean async_pong(gpointer data)
  {
    GLibJsonRpcServer *server = (GLibJsonRpcServer*)data;
    JsonNode *response = json_node_new(JSON_NODE_VALUE);
    json_node_set_string(response, "async_pong");

    glib_jsonrpc_server_send_async_response(server,
                                            response);
    return 0;
  }

The catch is that the async command has to return immediately, but it
can launch a long command through the g_timeout_add() or g_idle_add().
This is also necessary if you want to update the gui, which runs in
different thread.

Regards,
Dov

On Tue, Dec 27, 2011 at 09:20, Joakim Sindholt <opensource zhasha com> wrote:
> I've been writing a JSON-RPC library but it went on hold due to school.
> It's not up on a public git repo right now but it's a tad more feature
> complete than yours. I was working on supporting all encodings when I
> last left off.
>
> On Tue, 2011-12-27 at 06:52 +0200, Dov Grobgeld wrote:
>> I created jsonrpc client/server (http://json-rpc.org/) library through
>> glib/gio for remote controlling my application. It is available at:
>>
>> https://github.com/dov/glib-jsonrpc
>>
>> Comments and contributions are welcome.
>>
>> Regards,
>> Dov
>
> One thing that's indispensible for JSON-RPC is async calls. Regardless
> of whether you want to collaborate on this, you really need async
> methods.
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]