W3C home > Mailing lists > Public > public-web-intents@w3.org > January 2012

Re: Mapping WebIntents to Network Service Discovery API

From: Dave Raggett <dsr@w3.org>
Date: Tue, 10 Jan 2012 10:03:11 +0000
Message-ID: <4F0C0CDF.9060606@w3.org>
To: Cathy.Chan@nokia.com
CC: timeless@gmail.com, public-web-intents@w3.org
Hi Cathy,

> 7. The latest UPnP event relayed to the Site would indicate that the printer 
> state is "stopped" because it's out of paper. The Site notifies the user.

Could you please clarify what you mean by site?  Do you mean the web
page and its scripts, or do you mean the http server that the web page
was downloaded from?  My guess is the former, but I wanted to make sure.

How much knowledge would a UPnP browser be expected to have of services
delivered over UPnP? For instance would it know about the kinds of
events associated with printing and be able to present these directly to
the user?

My guess is that the browser would only have limited knowledge of the
basic UPnP mechanisms. In which case it would need a way to communicate
UPnP events to the web page scripts to act upon.

My reading of the discussion on this list is that Web Intents supports
the remote procedure call idiom, where the user selects the provider
that receives the call. For the current use case, this call would be the
request to print a given resource.

How can the web page tie a particular UPnP event to a particular print
request?

There are a number of possibilities for consideration:

1. The print request could set a call back for notifications, which
could be used in conjunction with a closure.

2. The print request could set an object with a method that is called by
the browser to deliver notifications. This technique is used in Firefox
for observer notifications.

3. The print request could set an id that is included in the
notification, enabling web page scripts to relate the notification to
the request.

If the browser provides the notification via postMessage, the web page
script could use window.addEventListener to register a function to
handle messages. This function would need to examine the origin and data
fields of each message to determine how to dispatch the message, since
the function would need to handle all messages delivered via postMessage.

What would be the origin for a UPnP printer on the home network?

>From a scripting point of view it would be cleaner to have a dedicated
handler for the specific print request. My preference would be for
option 2 above.

The web intent invocation would presumably look something like:

var intent = new Intent("http://webintents.org/print");
window.navigator.startActivity(intent, handler);

where handler is an object that supports the notification interface. We
could standardize that interface on a per intent basis, depending upon
how much knowledge of the intent, the browser needs to have. The handler
argument is optional, if missing or null, you don't get notifications.

Comments?

-- 
Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
Received on Tuesday, 10 January 2012 10:06:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 10 January 2012 10:06:28 GMT