Re: Announce: glib-jsonrpc



Hi,

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.

Just got back from holiday and thought I'd post a few comments.

First off, I think this sort of thing is useful. Especially when you
consider the possibilities of automatically discovering applications
running near you using avahi. (A remote control application becomes
trivial).

I'm not a fan of the approach to hand-writing the HTTP responses. There
are so many quirks in HTTP clients. SoupSessionAsync suits the job well
and scales more than well enough for this use-case. I imagine it would
also make it easier to handle multiple async commands concurrently.

As for the API, I'm not a huge fan of registering commands with a
generic callback scheme. It requires lots of boilerplate code which we
used to deal with in the early DBUS days (well, if you support
parameters, not sure this does yet). I would like to see a design where
you register a GObject at a path, like GDBUS, and GObject Introspection
is used to route the given method. Parameters would be passed in as the
POST body with a Content-Type of application/json. Then, a single,
generic marshaller could be written to convert the argument parameters.

Additionally, this would allow for discovery of a given methods
parameters with a GET request to the given method by describing them in
a JSON response. Or a list of methods available with a GET to the
objects path.

And at this point, I expect flames about re-implementing DBUS. However,
I still find it useful in cases where DBUS clients aren't viable (JSON
API server, application controllable by iOS/Android, etc).

Cheers,

-- Christian




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