W3C home > Mailing lists > Public > public-device-apis@w3.org > January 2010

Re: Why aren't most devices virtual web services?

From: Kenton Varda <kenton@google.com>
Date: Thu, 14 Jan 2010 13:50:16 -0800
Message-ID: <4112ecad1001141350r7d20d64brb4920be8f599aa02@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: John Kemp <john@jkemp.net>, Robin Berjon <robin@robineko.com>, Ilkka Oksanen <Ilkka.Oksanen@nokia.com>, "Mark S. Miller" <erights@google.com>, "public-device-apis@w3.org Policy WG" <public-device-apis@w3.org>
On Thu, Jan 14, 2010 at 12:36 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Thu, 14 Jan 2010, John Kemp wrote:
> > On Jan 14, 2010, at 3:00 PM, Ian Hickson wrote:
> > > On Thu, 14 Jan 2010, John Kemp wrote:
> > >>
> > >> We are designing Javascript APIs here. Those APIs involve making
> > >> Javascript calls.
> > >
> > > Is this a requirement? If so, why? It seems like if it makes more
> > > sense to expose something as a RESTful API exposed with a custom
> > > scheme handled natively by the UA, then we should do that, rather than
> > > expose things as a JavaScript API.
> >
> > I think what likely makes most sense is what Kenton suggested earlier -
> > a WebIDL binding for RESTful services. That way we should get
> > equivalence between the JS API and the RESTful model without having to
> > specify entirely separate ways (or a new way) of doing things.
>
> Would that mean the API was exposed to users twice? If so, I think it's a
> bad idea -- it would mean two implementations in browsers, and thus twice
> the number of bugs.
>

What I was imagining is that UAs would provide a function like:
  urlToObject(url, interface);

"interface" would be a (URL to a?) definition of the interface, perhaps in
WebIDL or maybe in some equivalent language.  "url" points to the RESTful
API representing a resource implementing this interface.  urlToObject()
returns an object implementing the WebIDL interface in terms of the RESTful
interface.  We then define some standard for this mapping.

For the record, I personally don't have any problem with only providing the
REST API with no automatic conversion to something more friendly.  But if
some people are worried that using XHR directly is too much of a pain -- and
making clients download helper libraries is too expensive -- then maybe a
standard urlToObject() would solve their problem.
Received on Thursday, 14 January 2010 21:51:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:05 GMT