Re: [Fwd: local device discovery - api, demo and source code]

On Mon, 2011-04-18 at 11:06 +0200, Jean-Claude Dufourd wrote:
> Hi Dave
> 
> On 16/4/11 11:45 , Dave Raggett wrote:
> > A more sophisticated approach would allow you as a web page developer to
> > designate a markup element as a message hub.
> JCD: Can you please expand on that sentence ? Are you saying that (a 
> clone of) an incoming XML message could end up simply appended to a 
> element in the DOM ?

No.

You would include an attribute in the markup that the library script can
identify. The html tag name isn't critical, e.g. you could use div or
span. The script library would dispatch an event on the element's DOM
node for an incoming message. The event object itself would include the
message as property whose value is a JSON object created by calling
JSON.stringify() on the string conveyed in the message. The library
script would likewise set an event listener on the element's node to
send an message in response to events being targeted at the node. This
assumes a new kind of event, perhaps derived from the existing event
classes, as permitted by the DOM.

Of course, we could use XML in place of JSON, but the latter is
increasingly popular due to the ease of manipulation by scripts.
-- 
 Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett

Received on Monday, 18 April 2011 10:43:12 UTC