discovery-api/Overview.src.html
author Rich Tibbett <richt@opera.com>
Wed, 03 Oct 2012 02:40:46 +0200
changeset 250 8b912f2bb9c7
parent 243 220f3226b2a1
child 254 f29ec967fb3b
permissions -rw-r--r--
Updates to Service Discovery & Messaging according to feedback @ http://lists.w3.org/Archives/Public/public-device-apis/2012Oct/0005.html
richt@180
     1
<!DOCTYPE html>
richt@239
     2
<!--
richt@239
     3
richt@239
     4
  THIS IS THE WORKING VERSION OF THE CURRENT SPECIFICATION!
richt@239
     5
richt@239
     6
  This specification is built using ReSpec.js <http://dev.w3.org/2009/dap/ReSpec.js/documentation.html>
richt@239
     7
richt@239
     8
  From time to time it's necessary to HTML5 Tidy this document using the tool @ <http://w3c.github.com/tidy-html5/>.
richt@239
     9
richt@239
    10
  The command used to format this document (Overview.src.html) is as follows (replacing all = signs with - signs!):
richt@239
    11
richt@239
    12
  @> tidy ==new-blocklevel-tags section ==char-encoding utf8 ==tidy-mark no ==indent yes ==indent-spaces 2 ==indent-attributes yes ==wrap 120 ==fix-bad-comments yes -m Overview.src.html
richt@239
    13
richt@239
    14
  To publish a new compiled version (Overview.html), we need to open this file (Overview.src.html) in any web browser.
richt@239
    15
  Once it has loaded we press 'Ctrl + Shift + S' (or 'Cmd' + 'Shift' + 'S' on Mac) and then select
richt@239
    16
  'Save as HTML (Source)' from the resulting menu.
richt@239
    17
richt@239
    18
  We then replace Overview.html with the produced HTML source of this process.
richt@239
    19
richt@239
    20
  Next we run HTML5 Tidy over our new Overview.html file with the following command (replacing all = signs with - signs!):
richt@239
    21
richt@239
    22
  @> tidy ==new-blocklevel-tags section ==char-encoding utf8 ==tidy-mark no ==indent yes ==indent-spaces 2 ==indent-attributes yes ==wrap 120 ==hide-comments yes -m Overview.html
richt@239
    23
richt@239
    24
  Now the specification is ready to be published :)
richt@239
    25
richt@239
    26
-->
richt@180
    27
<html>
richt@180
    28
  <head>
richt@239
    29
    <title>
richt@239
    30
      Network Service Discovery
richt@239
    31
    </title>
richt@239
    32
    <meta http-equiv='Content-Type'
richt@239
    33
          content='text/html; charset=utf-8'>
richt@239
    34
    <script type="text/javascript"
richt@239
    35
          class='remove'>
richt@239
    36
var respecConfig = {
richt@191
    37
          specStatus:   "ED",
richt@243
    38
          //publishDate:  "2012-10-09",
richt@191
    39
          shortName:    "discovery-api",
richt@230
    40
          edDraftURI:   "http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html",
richt@241
    41
          previousMaturity: "FPWD",
richt@191
    42
          previousPublishDate: "2012-08-07",
richt@180
    43
          editors: [
richt@191
    44
            {
richt@191
    45
              name:       "Rich Tibbett",
richt@191
    46
              //url:        "http://richt.me/",
richt@191
    47
              company:    "Opera Software ASA",
richt@191
    48
              companyURL: "http://opera.com/"
richt@191
    49
            },
richt@191
    50
            {
richt@191
    51
              name:       "Clarke Stevens",
richt@191
    52
              //url:      "",
richt@191
    53
              company:    "CableLabs",
richt@191
    54
              companyURL: "http://cablelabs.com/"
richt@191
    55
            }
richt@180
    56
          ],
richt@191
    57
          noIDLIn:      true,
richt@241
    58
          wg:           "Device APIs Working Group",
richt@180
    59
          wgURI:        "http://www.w3.org/2009/dap/",
richt@180
    60
          wgPublicList: "public-device-apis",
richt@191
    61
          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status"
richt@180
    62
      };
richt@180
    63
    </script>
richt@239
    64
    <script src='http://www.w3.org/Tools/respec/respec-w3c-common'
richt@239
    65
          type="text/javascript"
richt@239
    66
          class='remove'
richt@239
    67
          async="">
richt@239
    68
</script>
richt@180
    69
    <style type="text/css">
richt@239
    70
/* Custom ReSpec CSS (by Rich Tibbett) */
richt@180
    71
richt@180
    72
      /* Add better spacing to sections */
richt@180
    73
      section, .section { margin-bottom: 2em; }
richt@180
    74
richt@180
    75
      /* Reduce note & issue render size */
richt@180
    76
      .note, .issue { font-size:0.8em; }
richt@180
    77
richt@180
    78
      /* Add addition spacing to <ol> and <ul> for rule definition */
richt@180
    79
      ol.rule li, ul.rule li { padding:0.6em; }
richt@180
    80
richt@180
    81
      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
richt@180
    82
      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
richt@180
    83
      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
richt@180
    84
richt@180
    85
      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
richt@180
    86
      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
richt@180
    87
richt@180
    88
      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
richt@180
    89
      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
richt@180
    90
      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
richt@180
    91
      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
richt@180
    92
      dl.domintro dd p { margin: 0.5em 0; }
richt@180
    93
      dl.domintro code {font-size: inherit; font-style: italic; }
richt@180
    94
      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
richt@238
    95
richt@238
    96
      table { border-collapse:collapse; border-style:hidden hidden none hidden }
richt@238
    97
      table thead { border-bottom:solid }
richt@238
    98
      table tbody th:first-child { border-left:solid }
richt@238
    99
      table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em }
richt@180
   100
    </style>
richt@180
   101
  </head>
richt@180
   102
  <body>
richt@180
   103
    <section id='abstract'>
richt@180
   104
      <p>
richt@239
   105
        This specification defines a mechanism for an HTML document to discover and subsequently communicate with
richt@239
   106
        <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services advertised via common discovery protocols
richt@239
   107
        within the current network.
richt@180
   108
      </p>
richt@180
   109
    </section>
richt@180
   110
    <section id='sotd'>
richt@180
   111
      <p>
richt@239
   112
        This document represents the early consensus of the group on the scope and features of the proposed API.
richt@180
   113
      </p>
richt@180
   114
    </section>
richt@180
   115
    <section class="informative">
richt@239
   116
      <h3>
richt@239
   117
        Introduction
richt@239
   118
      </h3>
richt@180
   119
      <p>
richt@239
   120
        To enable Web pages to connect and communicate with Local-networked Services provided over HTTP, this
richt@239
   121
        specification introduces the <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a>
richt@239
   122
        interface.
richt@180
   123
      </p>
richt@180
   124
      <p>
richt@239
   125
        Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known
richt@239
   126
        service type, known by developers and advertised by Local-networked Devices. User authorization, where the user
richt@239
   127
        connects the web page to one or more discovered services, is expected before the web page is able to interact
richt@239
   128
        with any Local-networked Services.
richt@180
   129
      </p>
richt@180
   130
      <p>
richt@239
   131
        A web page creates a request to obtain connectivity to services running in the network by specifying a
richt@239
   132
        well-known discovery service type that it wishes to interact with.
richt@180
   133
      </p>
richt@180
   134
      <p>
richt@250
   135
        The user agent, having captured all advertised services on the network from the <a>service discovery
richt@250
   136
        mechanisms</a> included in this recommendation, attempts to match the requested service type to a discovered
richt@250
   137
        service according to the processing described herein.
richt@180
   138
      </p>
richt@180
   139
      <p>
richt@239
   140
        If a service connectivity request is successful then the Web page is provided with the necessary information to
richt@239
   141
        communicate with the authorized Local-networked Service. If the request fails then the Web page will receive an
richt@239
   142
        error callback containing an error code describing the cause of Local-networked Service connectivity failure.
richt@180
   143
      </p>
richt@239
   144
      <p>
richt@239
   145
        Once connected to a Local-networked Service the Web page can send requests and receive responses to the
richt@239
   146
        Local-networked Service via the messaging format and appropriate channel inferred from the service type
richt@239
   147
        authorized via the provided API. The Web page, once connected, can also receive service-pushed events, in the
richt@239
   148
        messaging format supported by the Local-networked Device, if such event subscription functionality is provided
richt@239
   149
        by the connected Local-networked Service.
richt@239
   150
      </p>
richt@180
   151
      <div class="example">
richt@239
   152
        <p>
richt@239
   153
          Example of requesting a DNS-SD advertised service:
richt@239
   154
        </p>
richt@239
   155
        <hr>
richt@239
   156
        <pre class="highlight">
richt@239
   157
function showServices( services ) {
richt@180
   158
  // Show a list of all the services provided to the web page
richt@239
   159
  for(var i = 0, l = services.length; i &lt; l; i++) console.log( services[i].name );
richt@180
   160
}
richt@180
   161
richt@239
   162
navigator.getNetworkServices('zeroconf:_boxee-jsonrpc._tcp', showServices);
richt@239
   163
</pre>
richt@180
   164
      </div>
richt@180
   165
      <div class="example">
richt@239
   166
        <p>
richt@239
   167
          Example of requesting a UPnP advertised service, also handling error conditions:
richt@239
   168
        </p>
richt@239
   169
        <hr>
richt@239
   170
        <pre class="highlight">
richt@239
   171
function showServices( services ) {
richt@180
   172
  // Show a list of all the services provided to the web page
richt@239
   173
  for(var i = 0, l = services.length; i &lt; l; i++) console.log( services[i].name );
richt@180
   174
}
richt@180
   175
richt@180
   176
function error( e ) {
richt@180
   177
  console.log( "Error occurred: " + e.code );
richt@180
   178
}
richt@180
   179
richt@239
   180
navigator.getNetworkServices('upnp:urn:schemas-upnp-org:service:ContentDirectory:1', showServices, error);
richt@239
   181
</pre>
richt@180
   182
      </div>
richt@180
   183
      <div class="example">
richt@239
   184
        <p>
richt@239
   185
          Example of requesting either a DNS-SD or UPnP advertised service:
richt@239
   186
        </p>
richt@239
   187
        <hr>
richt@239
   188
        <pre class="highlight">
richt@239
   189
function showServices( services ) {
richt@180
   190
  // Show a list of all the services provided to the web page (+ service type)
richt@239
   191
  for(var i = 0, l = services.length; i &lt; l; i++)
richt@180
   192
     console.log( services[i].name + '(' + services[i].type + ')' );
richt@180
   193
}
richt@180
   194
richt@180
   195
navigator.getNetworkServices([
richt@180
   196
  'zeroconf:_boxee-jsonrpc._tcp',
richt@180
   197
  'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'
richt@239
   198
], showServices);
richt@239
   199
</pre>
richt@180
   200
      </div>
richt@239
   201
      <p>
richt@239
   202
        For more detailed examples see the <a href="#examples">Examples</a> section.
richt@239
   203
      </p>
richt@180
   204
    </section>
richt@239
   205
    <section id='conformance'>
richt@239
   206
      <p>
richt@239
   207
        Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or
richt@239
   208
        "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should",
richt@239
   209
        "may", etc) used in introducing the algorithm.
richt@239
   210
      </p>
richt@239
   211
      <p>
richt@239
   212
        Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements
richt@239
   213
        are to be interpreted as requirements on user agents.
richt@239
   214
      </p>
richt@239
   215
      <p>
richt@250
   216
        Conformance requirements phrased as algorithms or specific steps MAY be implemented in any manner, so long as
richt@250
   217
        the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be
richt@250
   218
        easy to follow, and not intended to be performant.)
richt@239
   219
      </p>
richt@239
   220
      <p>
richt@239
   221
        The only conformance class defined by this specification is a <dfn>user agent</dfn>.
richt@239
   222
      </p>
richt@239
   223
      <p>
richt@250
   224
        User agents MAY impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial
richt@250
   225
        of service attacks, to guard against running out of memory, or to work around platform-specific limitations.
richt@239
   226
      </p>
richt@239
   227
      <p>
richt@239
   228
        When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid
richt@250
   229
        in development, or for performance reasons), user agents MUST act as if they had no support for the feature
richt@250
   230
        whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature
richt@250
   231
        is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects
richt@250
   232
        that implement that interface - leaving the attribute on the object but making it return null or throw an
richt@250
   233
        exception is insufficient.
richt@239
   234
      </p>
richt@180
   235
      <section>
richt@239
   236
        <h3>
richt@239
   237
          Dependencies
richt@239
   238
        </h3>This specification relies on several other underlying specifications.
richt@239
   239
        <dl>
richt@239
   240
          <dt>
richt@239
   241
            HTML
richt@239
   242
          </dt>
richt@239
   243
          <dd>
richt@239
   244
            Many fundamental concepts from HTML are used by this specification. [[!HTML5]]
richt@239
   245
          </dd>
richt@239
   246
          <dt>
richt@239
   247
            WebIDL
richt@239
   248
          </dt>
richt@239
   249
          <dd>
richt@239
   250
            The IDL blocks in this specification use the semantics of the WebIDL specification. [[!WEBIDL]]
richt@239
   251
          </dd>
richt@239
   252
        </dl>
richt@180
   253
      </section>
richt@180
   254
    </section>
richt@180
   255
    <section>
richt@239
   256
      <h3>
richt@239
   257
        Terminology
richt@239
   258
      </h3>
richt@180
   259
      <p>
richt@239
   260
        The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes
richt@239
   261
        used instead of the more accurate "an object implementing the interface <code>Foo</code>".
richt@180
   262
      </p>
richt@180
   263
      <p>
richt@239
   264
        The term DOM is used to refer to the API set made available to scripts in Web applications, and does not
richt@239
   265
        necessarily imply the existence of an actual <code>Document</code> object or of any other <code>Node</code>
richt@239
   266
        objects as defined in the DOM Core specifications. [[!DOM4]]
richt@180
   267
      </p>
richt@180
   268
      <p>
richt@239
   269
        An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and
richt@239
   270
        is said to be <em>setting</em> when a new value is assigned to it.
richt@180
   271
      </p>
richt@180
   272
      <p>
richt@239
   273
        A <dfn>valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code>
richt@239
   274
        followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E,
richt@239
   275
        U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
richt@180
   276
      </p>
richt@180
   277
      <p>
richt@239
   278
        A <a>valid service type</a> provided in the <code>type</code> attribute of the <a href=
richt@239
   279
        "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method will be matched against the
richt@239
   280
        services currently contained in the <a>list of available service records</a> according to the algorithms
richt@239
   281
        defined in this specification.
richt@180
   282
      </p>
richt@230
   283
      <p>
richt@239
   284
        A <dfn>user-agent generated callback url</dfn> is a Local-network accessible URL endpoint that a <a>user
richt@239
   285
        agent</a> generates and maintains for receiving HTTP NOTIFY requests from UPnP Event sources. It is only
richt@239
   286
        required when the user agent implements UPnP Service Discovery as defined in this specification.
richt@230
   287
      </p>
richt@180
   288
    </section>
richt@180
   289
    <section>
richt@239
   290
      <h2>
richt@239
   291
        Requesting networked services
richt@239
   292
      </h2>
richt@239
   293
      <pre class="widl">
richt@239
   294
[Supplemental, NoInterfaceObject]
richt@180
   295
interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
richt@180
   296
  // Obtain a Local-networked Service
richt@180
   297
  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
richt@239
   298
                           in <a href=
richt@239
   299
"#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
richt@239
   300
                           in optional <a href=
richt@239
   301
"#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
richt@180
   302
};
richt@239
   303
<a class="externalDFN"
richt@239
   304
     href=
richt@239
   305
     "http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href=
richt@239
   306
     "#navigatornetworkservice">NavigatorNetworkService</a>;
richt@180
   307
richt@180
   308
[Callback=FunctionOnly, NoInterfaceObject]
richt@180
   309
interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
richt@180
   310
  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
richt@180
   311
};
richt@180
   312
richt@180
   313
[NoInterfaceObject]
richt@180
   314
interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
richt@180
   315
  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
richt@180
   316
  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
richt@180
   317
  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
richt@180
   318
};
richt@180
   319
richt@180
   320
[Callback=FunctionOnly, NoInterfaceObject]
richt@180
   321
interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
richt@180
   322
  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
richt@180
   323
};
richt@180
   324
</pre>
richt@239
   325
      <section>
richt@239
   326
        <h2>
richt@239
   327
          Methods
richt@239
   328
        </h2>
richt@239
   329
        <dl class="domintro">
richt@239
   330
          <dt>
richt@239
   331
            <var title="">window</var> . <code title="dom-navigator"><a href=
richt@239
   332
            "http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a></code> .
richt@239
   333
            <code title="dom-navigator-getNetworkServices"><a href=
richt@239
   334
            "#dom-navigator-getnetworkservices">getNetworkServices</a></code> ( <var title="">type</var> , <var title=
richt@239
   335
            "">successCallback</var> [, <var title="">errorCallback</var> ] )
richt@239
   336
          </dt>
richt@239
   337
          <dd>
richt@239
   338
            <p>
richt@239
   339
              Prompts the user to select one or more discovered network services that have advertised support for the
richt@239
   340
              requested service type.
richt@239
   341
            </p>
richt@239
   342
            <p>
richt@239
   343
              The <var title="">type</var> argument contains one or more <a>valid service type</a> tokens that the web
richt@239
   344
              page would like to interact with.
richt@239
   345
            </p>
richt@239
   346
            <p>
richt@240
   347
              If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href=
richt@240
   348
              "#networkservice"><code>NetworkService</code></a> objects as its argument.
richt@239
   349
            </p>
richt@239
   350
            <p>
richt@239
   351
              If the user declines, the <var title="">errorCallback</var> (if any) is invoked.
richt@239
   352
            </p>
richt@239
   353
          </dd>
richt@239
   354
        </dl>
richt@239
   355
        <div>
richt@180
   356
          <p>
richt@239
   357
            When the <dfn id="dom-navigator-getnetworkservices"
richt@239
   358
               title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[,
richt@250
   359
               errorCallback])</code></dfn> method is called, the <a>user agent</a> MUST run the following steps:
richt@180
   360
          </p>
richt@180
   361
          <ol class="rule">
richt@239
   362
            <li>Let <var>requested control types</var> be initially set to an empty array.
richt@239
   363
            </li>
richt@239
   364
            <li>If <var>type</var> is an array consisting of one or more <a>valid service type</a> tokens, then let
richt@239
   365
            <var>requested control types</var> by the value of <var>type</var>, removing any non-<a>valid service
richt@239
   366
            type</a> tokens from the resulting array.
richt@239
   367
            </li>
richt@239
   368
            <li>If <var>type</var> is a string consisting of one <a>valid service type</a> token, then let
richt@239
   369
            <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
richt@239
   370
            </li>
richt@239
   371
            <li>If <var>requested control types</var> is an array that contains at least one or more <a title=
richt@239
   372
            "valid service type">valid service type</a> tokens then continue to the step labeled <em>process</em>
richt@240
   373
            below. Otherwise, the <a>user agent</a> MUST <a href=
richt@239
   374
            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
   375
                  class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
richt@239
   376
                  object of type <code>Function</code>, with a new <a href=
richt@239
   377
                  "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
richt@239
   378
                  "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
richt@239
   379
                  (<a href=
richt@239
   380
                  "#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as
richt@239
   381
                  its argument, abort any remaining steps and return.
richt@239
   382
            </li>
richt@180
   383
            <li>
richt@239
   384
              <em>Process</em>: Let <var>services found</var> be an empty array.
richt@180
   385
            </li>
richt@239
   386
            <li>For each <var>available service</var> in the <a>list of available service records</a> run the following
richt@239
   387
            steps:
richt@239
   388
              <ol class="rule">
richt@239
   389
                <li>For each <var>requested control type</var> in <var>requested control types</var>: If <var>available
richt@239
   390
                service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>
richt@239
   391
                  matched service</var> equal the value of <var>available service</var> and continue at the step
richt@239
   392
                  labeled <var>attach</var> below.
richt@239
   393
                </li>
richt@239
   394
                <li>Continue at the next <var>available service</var>.
richt@239
   395
                </li>
richt@239
   396
                <li>
richt@239
   397
                  <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
richt@239
   398
                  <ol class="rule">
richt@239
   399
                    <li>Let <var>new service object</var> be a new <a href=
richt@239
   400
                    "#networkservice"><code>NetworkService</code></a> object, mapping the parameters of <var>matched
richt@239
   401
                    service</var> to this new object where possible.
richt@239
   402
                    </li>
richt@239
   403
                    <li>Append <var>new service object</var> to the <var>services found</var> array.
richt@239
   404
                    </li>
richt@239
   405
                  </ol>
richt@239
   406
                </li>
richt@239
   407
              </ol>
richt@180
   408
            </li>
richt@250
   409
            <li>If <var>services found</var> is an empty array, then the <a>user agent</a> MUST <a href=
richt@250
   410
            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
   411
                  class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
richt@239
   412
                  object of type <code>Function</code>, with a new <a href=
richt@239
   413
                  "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
richt@239
   414
                  "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
richt@239
   415
                  (<a href=
richt@239
   416
                  "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
richt@239
   417
                  argument, abort any remaining steps and return.
richt@180
   418
            </li>
richt@239
   419
            <li>Return, and run the remaining steps asynchronously.
richt@180
   420
            </li>
richt@239
   421
            <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to
richt@240
   422
            platform limitations, the <a>user agent</a> MAY <a href=
richt@239
   423
            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
   424
                  class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
richt@239
   425
                  object of type <code>Function</code>, with a new <a href=
richt@239
   426
                  "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
richt@239
   427
                  "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
richt@239
   428
                  (<a href=
richt@239
   429
                  "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
richt@239
   430
                  argument, abort any remaining steps and return.
richt@180
   431
            </li>
richt@250
   432
            <li>The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for permission to provide
richt@250
   433
            the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
richt@239
   434
                  class="externalDFN">entry script</a>'s <a href=
richt@239
   435
                  "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
richt@239
   436
                  class="externalDFN">origin</a> with an array of <a href=
richt@239
   437
                  "#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of
richt@239
   438
                  <var>services found</var>.
richt@239
   439
              <p>
richt@239
   440
                If the user grants permission to access one or more networked services then the <a>user agent</a>
richt@239
   441
                SHOULD include an "ongoing local-network communication" indicator.
richt@180
   442
              </p>
richt@239
   443
              <p>
richt@240
   444
                If the user denies permission, then the <a>user agent</a> MUST <a href=
richt@239
   445
                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
   446
                   class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
richt@239
   447
                   object of type <code>Function</code>, with a new <a href=
richt@239
   448
                   "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
richt@239
   449
                   "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
richt@239
   450
                   (<a href=
richt@239
   451
                   "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
richt@239
   452
                   argument, abort any remaining steps and return.
richt@239
   453
              </p>
richt@180
   454
              <p>
richt@180
   455
                If the user never responds, this algorithm stalls on this step.
richt@180
   456
              </p>
richt@180
   457
            </li>
richt@239
   458
            <li>Let <var>services</var> be the array of one or more <a href=
richt@239
   459
            "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
richt@180
   460
            </li>
richt@240
   461
            <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps:
richt@239
   462
              <ol class="rule">
richt@239
   463
                <li>Add the <var>service</var>'s <code>url</code> parameter to the <a>entry script origin's
richt@239
   464
                  <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
richt@239
   465
                </li>
richt@239
   466
                <li>If <var>service</var>'s <code>type</code> parameter begins with the DOMString "<code>upnp:</code>"
richt@239
   467
                and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a>setup a UPnP Events
richt@239
   468
                Subscription</a> for <var>service</var>.
richt@239
   469
                </li>
richt@239
   470
              </ol>
richt@180
   471
            </li>
richt@239
   472
            <li>Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a>
richt@239
   473
            object.
richt@180
   474
            </li>
richt@239
   475
            <li>Set <var>services manager</var>'s <a href=
richt@239
   476
            "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of
richt@250
   477
            items currently found in the <a>list of available service records</a> whose <code>type</code> property
richt@239
   478
            matches any of the tokens requested in <var>requested control types</var>.
richt@180
   479
            </li>
richt@250
   480
            <li>Add <var>services</var> to the <var>services manager</var> object as its collection of <a>indexed
richt@250
   481
            properties</a>.
richt@250
   482
            </li>
richt@250
   483
            <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a>
richt@250
   484
            attribute to the number of items in <var>services</var>.
richt@250
   485
            </li>
richt@250
   486
            <li>Add <var>services manager</var> to the <a>list of active service managers</a>.
richt@180
   487
            </li>
richt@240
   488
            <li>The <a>user agent</a> MUST <a href=
richt@239
   489
            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
   490
                  class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with <var>services
richt@239
   491
                  manager</var> as its argument.
richt@180
   492
            </li>
richt@180
   493
          </ol>
richt@180
   494
          <p>
richt@239
   495
            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source"
richt@239
   496
               class="externalDFN">task source</a> for these <a href=
richt@239
   497
               "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task"
richt@239
   498
               class="externalDFN">tasks</a> is the <a href=
richt@239
   499
               "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source"
richt@239
   500
               class="externalDFN">user interaction task source</a>.
richt@180
   501
          </p>
richt@180
   502
          <p>
richt@239
   503
            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the
richt@250
   504
            <a>user agent</a> MUST add the <code>url</code> property to the <dfn>entry script origin's URL
richt@250
   505
            whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource requests
richt@250
   506
            towards these URLs, and any sub-resources of these URLs, within the current <a href=
richt@239
   507
            "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
richt@239
   508
               class="externalDFN">entry script</a>'s <a href=
richt@239
   509
               "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
richt@239
   510
               class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
richt@239
   511
               Web Messaging, XMLHttpRequest).
richt@239
   512
          </p>
richt@180
   513
          <p>
richt@239
   514
            If the user navigates away from the current browsing context, the <a>user agent</a> <em class=
richt@239
   515
            "ct">MUST</em> remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a>.
richt@239
   516
            There is no persistence to network service selections provided to a web page. It is not possible to access
richt@239
   517
            a previously white-listed networked service without the necessary user authorization in all of the
richt@239
   518
            following cases:
richt@180
   519
          </p>
richt@239
   520
          <ul>
richt@239
   521
            <li>If the current script is reloaded at any point in the same or different window.
richt@239
   522
            </li>
richt@239
   523
            <li>if the current script reinvokes the <a href=
richt@239
   524
            "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its
richt@239
   525
            execution.
richt@239
   526
            </li>
richt@239
   527
            <li>If the user navigates forward or back in their history to reload the current page.
richt@239
   528
            </li>
richt@239
   529
            <li>If a script is running in a different origin.
richt@239
   530
            </li>
richt@239
   531
          </ul>
richt@239
   532
        </div>
richt@180
   533
      </section>
richt@180
   534
      <section>
richt@239
   535
        <h3>
richt@239
   536
          Error Handling
richt@239
   537
        </h3>
richt@239
   538
        <dl class="domintro">
richt@239
   539
          <dt>
richt@239
   540
            <var title="">error</var> . <code title="dom-NavigatorNetworkServiceError-code"><a href=
richt@239
   541
            "#dom-navigatornetworkserviceerror-code">code</a></code>
richt@239
   542
          </dt>
richt@239
   543
          <dd>
richt@239
   544
            <p>
richt@239
   545
              Returns the current error's error code. At the current time, this will be <code>1</code> or
richt@239
   546
              <code>2</code>, for which the corresponding error constants <a href=
richt@239
   547
              "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and <a href=
richt@239
   548
              "#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are
richt@239
   549
              defined.
richt@239
   550
            </p>
richt@239
   551
          </dd>
richt@239
   552
        </dl>
richt@239
   553
        <p>
richt@239
   554
          The <dfn id="dom-navigatornetworkserviceerror-code"
richt@239
   555
             title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a <a href=
richt@239
   556
             "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em class=
richt@239
   557
             "ct">MUST</em> return the code for the error, which will be one of the following:
richt@239
   558
        </p>
richt@239
   559
        <dl>
richt@239
   560
          <dt>
richt@239
   561
            <dfn id="dom-navigatornetworkserviceerror-permission_denied"
richt@239
   562
                title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn>
richt@239
   563
                (numeric value 1)
richt@239
   564
          </dt>
richt@239
   565
          <dd>
richt@239
   566
            The user or user agent denied the page permission to access any services.
richt@239
   567
          </dd>
richt@239
   568
          <dt>
richt@239
   569
            <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix"
richt@239
   570
                title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn>
richt@239
   571
                (numeric value 2)
richt@239
   572
          </dt>
richt@239
   573
          <dd>
richt@239
   574
            No <a>valid service type</a> tokens were provided in the method invocation.
richt@239
   575
          </dd>
richt@239
   576
        </dl>
richt@239
   577
      </section>
richt@239
   578
    </section>
richt@239
   579
    <section>
richt@239
   580
      <h2>
richt@239
   581
        Obtaining networked services
richt@239
   582
      </h2>
richt@180
   583
      <p>
richt@239
   584
        The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from
richt@239
   585
        a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access
richt@239
   586
        to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given
richt@239
   587
        request.
richt@180
   588
      </p>
richt@239
   589
      <pre class="widl">
richt@180
   590
[NoInterfaceObject]
richt@180
   591
interface <dfn id="networkservices">NetworkServices</dfn> {
richt@180
   592
  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
richt@180
   593
  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
richt@239
   594
  <a href="#networkservice">NetworkService</a>? <a href=
richt@239
   595
"#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
richt@180
   596
richt@180
   597
  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
richt@180
   598
richt@180
   599
  // event handler attributes
richt@239
   600
           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
richt@239
   601
     class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
richt@239
   602
           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
richt@239
   603
     class="externalDFN">EventHandler</a>     <a href=
richt@239
   604
     "#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
richt@180
   605
richt@180
   606
};
richt@180
   607
richt@239
   608
<a href="#networkservices">NetworkServices</a> implements <a href=
richt@239
   609
"http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget"
richt@239
   610
     class="externalDFN">EventTarget</a>;
richt@180
   611
</pre>
richt@180
   612
      <section>
richt@239
   613
        <h2>
richt@239
   614
          Attributes
richt@239
   615
        </h2>
richt@180
   616
        <dl class="domintro">
richt@180
   617
          <dt>
richt@239
   618
            <code title="dom-networkservices-length"><a href="#dom-networkservices-length">length</a></code>
richt@180
   619
          </dt>
richt@180
   620
          <dd>
richt@180
   621
            <p>
richt@250
   622
              Returns the current number of items in the current object's collection of <a href=
richt@250
   623
              "#networkservice"><code>NetworkService</code></a> objects.
richt@180
   624
            </p>
richt@180
   625
          </dd>
richt@180
   626
          <dt>
richt@239
   627
            <code title="dom-networkservices-servicesavailable"><a href=
richt@239
   628
            "#dom-networkservices-servicesavailable">servicesAvailable</a></code>
richt@180
   629
          </dt>
richt@180
   630
          <dd>
richt@180
   631
            <p>
richt@250
   632
              Returns the current number of items matching one of the app-requested <a>valid service type</a> tokens in
richt@250
   633
              the <a>list of available service records</a>.
richt@180
   634
            </p>
richt@180
   635
          </dd>
richt@180
   636
        </dl>
richt@180
   637
        <div>
richt@239
   638
          <p>
richt@250
   639
            The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST return the number of
richt@250
   640
            <a href="#networkservice"><code>NetworkService</code></a> objects represented by the collection.
richt@239
   641
          </p>
richt@239
   642
          <p>
richt@250
   643
            The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute MUST
richt@250
   644
            return the number of services in the <a>list of available service records</a> whose <code>type</code>
richt@250
   645
            attribute matches any of the <a>valid service type</a> tokens that was initially used to create the current
richt@250
   646
            <a href="#networkservices"><code>NetworkServices</code></a> object.
richt@239
   647
          </p>
richt@180
   648
        </div>
richt@180
   649
      </section>
richt@180
   650
      <section>
richt@239
   651
        <h2>
richt@239
   652
          Methods
richt@239
   653
        </h2>
richt@180
   654
        <dl class="domintro">
richt@239
   655
          <dt>
richt@239
   656
            <code title="networkservices-getter"><a href="#networkservices">services</a></code> [ <var title=
richt@239
   657
            "">index</var> ]
richt@239
   658
          </dt>
richt@239
   659
          <dd>
richt@239
   660
            <p>
richt@239
   661
              Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
richt@239
   662
            </p>
richt@239
   663
          </dd>
richt@239
   664
          <dt>
richt@239
   665
            <code title="networkservices-getter"><a href="#networkservices">services</a></code> . <code title=
richt@239
   666
            "dom-networkservices-getservicebyid"><a href=
richt@239
   667
            "#dom-networkservices-getservicebyid">getServiceById</a></code> ( <var title="">id</var> )
richt@239
   668
          </dt>
richt@239
   669
          <dd>
richt@239
   670
            <p>
richt@239
   671
              Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier,
richt@239
   672
              or null if no service has that identifier.
richt@239
   673
            </p>
richt@239
   674
          </dd>
richt@239
   675
        </dl>
richt@239
   676
        <p>
richt@250
   677
          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of one
richt@250
   678
          or more <a href="#networkservice"><code>NetworkService</code></a> objects. A <a href=
richt@250
   679
          "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that it cannot
richt@250
   680
          be modified.
richt@239
   681
        </p>
richt@239
   682
        <p class="note">
richt@239
   683
          Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the
richt@239
   684
          first has the index 0, and each subsequent service is numbered one higher than the previous one.
richt@239
   685
        </p>
richt@239
   686
        <p>
richt@239
   687
          The <a href=
richt@239
   688
          "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices"
richt@239
   689
             class="externalDFN">supported property indices</a> of <a href=
richt@239
   690
             "#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to
richt@250
   691
             the number of the <a href="#networkservice"><code>NetworkService</code></a> objects in the collection
richt@250
   692
             minus one.
richt@239
   693
        </p>
richt@239
   694
        <p>
richt@239
   695
          To <a href=
richt@239
   696
          "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property"
richt@239
   697
             class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a
richt@250
   698
             <a href="#networkservices"><code>NetworkServices</code></a> object the user agent MUST return the <a href=
richt@250
   699
             "#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th item in
richt@250
   700
             the collection.
richt@239
   701
        </p>
richt@239
   702
        <p>
richt@239
   703
          The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class=
richt@239
   704
          "ct">MUST</em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in the
richt@250
   705
          collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the
richt@250
   706
          <var>id</var> argument provided. When no <a href="#networkservice"><code>NetworkService</code></a> objects
richt@250
   707
          match the given argument, the method MUST return null.
richt@239
   708
        </p>
richt@239
   709
        <p>
richt@239
   710
          Services available within the local network can connect and disconnect at different times during the
richt@239
   711
          execution of a web page. A <a>user agent</a> can inform a web page when the state of networked services
richt@239
   712
          matching the requested <a>valid service type</a> change. Web pages can use this information to enable in-page
richt@239
   713
          experiences for communicating the state of networked services with the ability to change the particular
richt@239
   714
          service or set of services the page is connected to by re-invoking the <a href=
richt@239
   715
          "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
richt@239
   716
        </p>
richt@180
   717
      </section>
richt@180
   718
      <section>
richt@239
   719
        <h2>
richt@239
   720
          Events
richt@239
   721
        </h2>
richt@239
   722
        <p>
richt@239
   723
          The following are the event handlers (and their corresponding event handler event types) that <em class=
richt@239
   724
          "ct">MUST</em> be supported, as IDL attributes, by all objects implementing the <a href=
richt@239
   725
          "#networkservices"><code>NetworkServices</code></a> interface:
richt@239
   726
        </p>
richt@243
   727
        <table border="1">
richt@239
   728
          <thead>
richt@239
   729
            <tr>
richt@239
   730
              <th>
richt@239
   731
                <span title="event handlers">Event handler</span>
richt@239
   732
              </th>
richt@239
   733
              <th>
richt@239
   734
                <span>Event handler event type</span>
richt@239
   735
              </th>
richt@239
   736
            </tr>
richt@239
   737
          </thead>
richt@239
   738
          <tbody>
richt@239
   739
            <tr>
richt@239
   740
              <td>
richt@239
   741
                <dfn id="dom-networkservices-onserviceavailable"
richt@239
   742
                    title="dom-NetworkServices-onserviceavailable"><code>onserviceavailable</code></dfn>
richt@239
   743
              </td>
richt@239
   744
              <td>
richt@239
   745
                <a href="#event-serviceavailable"><code>serviceavailable</code></a>
richt@239
   746
              </td>
richt@239
   747
            </tr>
richt@239
   748
            <tr>
richt@239
   749
              <td>
richt@239
   750
                <dfn id="dom-networkservices-onserviceunavailable"
richt@239
   751
                    title="dom-NetworkServices-onserviceunavailable"><code>onserviceunavailable</code></dfn>
richt@239
   752
              </td>
richt@239
   753
              <td>
richt@239
   754
                <a href="#event-serviceunavailable"><code>serviceunavailable</code></a>
richt@239
   755
              </td>
richt@239
   756
            </tr>
richt@239
   757
          </tbody>
richt@239
   758
        </table>
richt@180
   759
      </section>
richt@180
   760
    </section>
richt@180
   761
    <section>
richt@239
   762
      <h2>
richt@239
   763
        Communicating with a networked service
richt@239
   764
      </h2>
richt@239
   765
      <p>
richt@239
   766
        The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection
richt@239
   767
        information for an HTTP service endpoint and if available, service events, running on a networked device.
richt@239
   768
      </p>
richt@239
   769
      <pre class="widl">
richt@180
   770
[NoInterfaceObject]
richt@180
   771
interface <dfn id="networkservice">NetworkService</dfn> {
richt@180
   772
  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
richt@180
   773
  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
richt@180
   774
  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
richt@180
   775
  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
richt@180
   776
  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
richt@180
   777
richt@191
   778
  readonly attribute boolean          <a href="#dom-networkservice-online">online</a>;
richt@180
   779
richt@180
   780
  // event handler attributes
richt@239
   781
           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
richt@239
   782
     class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceonline">onserviceonline</a>;
richt@239
   783
           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
richt@239
   784
     class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>;
richt@191
   785
richt@239
   786
           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
richt@239
   787
     class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onnotify">onnotify</a>;
richt@180
   788
};
richt@180
   789
richt@239
   790
<a href="#networkservice">NetworkService</a> implements <a href=
richt@239
   791
"http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget"
richt@239
   792
     class="externalDFN">EventTarget</a>;
richt@180
   793
</pre>
richt@239
   794
      <section>
richt@239
   795
        <h2>
richt@239
   796
          Attributes
richt@239
   797
        </h2>
richt@239
   798
        <dl class="domintro">
richt@239
   799
          <dt>
richt@239
   800
            <var title="">service</var> . <code title="dom-networkservice-id"><a href=
richt@239
   801
            "#dom-networkservice-id">id</a></code>
richt@239
   802
          </dt>
richt@239
   803
          <dd>
richt@239
   804
            <p>
richt@239
   805
              A unique identifier for the given user-selected service instance.
richt@239
   806
            </p>
richt@239
   807
          </dd>
richt@239
   808
          <dt>
richt@239
   809
            <var title="">service</var> . <code title="dom-networkservice-name"><a href=
richt@239
   810
            "#dom-networkservice-name">name</a></code>
richt@239
   811
          </dt>
richt@239
   812
          <dd>
richt@239
   813
            <p>
richt@239
   814
              The name of the user-selected service.
richt@239
   815
            </p>
richt@239
   816
          </dd>
richt@239
   817
          <dt>
richt@239
   818
            <var title="">service</var> . <code title="dom-networkservice-type"><a href=
richt@239
   819
            "#dom-networkservice-type">type</a></code>
richt@239
   820
          </dt>
richt@239
   821
          <dd>
richt@239
   822
            <p>
richt@239
   823
              The <a>valid service type</a> token value of the user-selected service.
richt@239
   824
            </p>
richt@239
   825
          </dd>
richt@239
   826
          <dt>
richt@239
   827
            <var title="">service</var> . <code title="dom-networkservice-url"><a href=
richt@239
   828
            "#dom-networkservice-url">url</a></code>
richt@239
   829
          </dt>
richt@239
   830
          <dd>
richt@239
   831
            <p>
richt@239
   832
              The control URL endpoint (including any required port information) of the user-selected control service
richt@239
   833
              that has been added to the <a>entry script origin's URL whitelist</a>.
richt@239
   834
            </p>
richt@239
   835
          </dd>
richt@239
   836
          <dt>
richt@239
   837
            <var title="">service</var> . <code title="dom-networkservice-config"><a href=
richt@239
   838
            "#dom-networkservice-config">config</a></code>
richt@239
   839
          </dt>
richt@239
   840
          <dd>
richt@239
   841
            <p>
richt@239
   842
              The configuration information associated with the service depending on the requested service type.
richt@239
   843
            </p>
richt@239
   844
          </dd>
richt@239
   845
        </dl>
richt@239
   846
        <p>
richt@239
   847
          The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service.
richt@250
   848
          The same service provided at different times or on different objects MUST have the same <a href=
richt@250
   849
          "#dom-networkservice-id"><code>id</code></a> value.
richt@239
   850
        </p>
richt@239
   851
        <p>
richt@239
   852
          The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for
richt@239
   853
          the service.
richt@239
   854
        </p>
richt@239
   855
        <p>
richt@239
   856
          The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a>valid
richt@239
   857
          service type</a> of the service.
richt@239
   858
        </p>
richt@239
   859
        <p>
richt@239
   860
          The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href=
richt@239
   861
          "http://www.w3.org/TR/html5/urls.html#absolute-url"
richt@239
   862
             class="externalDFN">absolute URL</a> pointing to the root HTTP endpoint for the service that has been
richt@239
   863
             added to the <a>entry script origin's URL whitelist</a>. Web pages can subsequently use this value for
richt@239
   864
             implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
richt@239
   865
             Web Messaging, XMLHttpRequest).
richt@239
   866
        </p>
richt@239
   867
        <p>
richt@239
   868
          The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration
richt@239
   869
          information extracted from the given network service.
richt@239
   870
        </p>
richt@239
   871
      </section>
richt@239
   872
      <section>
richt@239
   873
        <h3>
richt@239
   874
          States
richt@239
   875
        </h3>
richt@239
   876
        <dl class="domintro">
richt@239
   877
          <dt>
richt@239
   878
            <var title="">service</var> . <code title="dom-networkservice-online"><a href=
richt@239
   879
            "#dom-networkservice-online">online</a></code>
richt@239
   880
          </dt>
richt@239
   881
          <dd>
richt@239
   882
            <p>
richt@239
   883
              Returns <code>true</code> if the service is reporting that it is accessible on the local network or
richt@239
   884
              <code>false</code> if the service is reporting that it is no longer accessible (temporarily or
richt@239
   885
              permanently) on the local network.
richt@239
   886
            </p>
richt@239
   887
          </dd>
richt@239
   888
        </dl>
richt@239
   889
        <p>
richt@239
   890
          The <dfn id="dom-networkservice-online"><code>online</code></dfn> attribute indicates whether the service is
richt@239
   891
          reporting itself as being either <var>online</var>, and therefore accessible on the local network, in which
richt@239
   892
          case this attribute will return <code>true</code> or, <var>offline</var>, and therefore not accessible on the
richt@239
   893
          local network, either temporarily or permanently, in which case this attribute will return
richt@240
   894
          <code>false</code>. This attribute MUST default to <code>true</code>.
richt@239
   895
        </p>
richt@239
   896
      </section>
richt@239
   897
      <section>
richt@239
   898
        <h3>
richt@239
   899
          Events
richt@239
   900
        </h3>
richt@239
   901
        <p>
richt@239
   902
          The following are the event handlers (and their corresponding event handler event types) that <em class=
richt@239
   903
          "ct">MUST</em> be supported, as IDL attributes, by all objects implementing the <a href=
richt@239
   904
          "#networkservice"><code>NetworkService</code></a> interface:
richt@239
   905
        </p>
richt@243
   906
        <table border="1">
richt@239
   907
          <thead>
richt@239
   908
            <tr>
richt@239
   909
              <th>
richt@239
   910
                <span title="event handlers">Event handler</span>
richt@239
   911
              </th>
richt@239
   912
              <th>
richt@239
   913
                <span>Event handler event type</span>
richt@239
   914
              </th>
richt@239
   915
            </tr>
richt@239
   916
          </thead>
richt@239
   917
          <tbody>
richt@239
   918
            <tr>
richt@239
   919
              <td>
richt@239
   920
                <dfn id="dom-networkservice-onnotify"
richt@239
   921
                    title="dom-NetworkService-onnotify"><code>onnotify</code></dfn>
richt@239
   922
              </td>
richt@239
   923
              <td>
richt@239
   924
                <a href="#event-notify"><code>notify</code></a>
richt@239
   925
              </td>
richt@239
   926
            </tr>
richt@239
   927
            <tr>
richt@239
   928
              <td>
richt@239
   929
                <dfn id="dom-networkservice-onserviceonline"
richt@239
   930
                    title="dom-NetworkService-onserviceonline"><code>onserviceonline</code></dfn>
richt@239
   931
              </td>
richt@239
   932
              <td>
richt@239
   933
                <a href="#event-serviceonline"><code>serviceonline</code></a>
richt@239
   934
              </td>
richt@239
   935
            </tr>
richt@239
   936
            <tr>
richt@239
   937
              <td>
richt@239
   938
                <dfn id="dom-networkservice-onserviceoffline"
richt@239
   939
                    title="dom-NetworkService-onserviceoffline"><code>onserviceoffline</code></dfn>
richt@239
   940
              </td>
richt@239
   941
              <td>
richt@239
   942
                <a href="#event-serviceoffline"><code>serviceoffline</code></a>
richt@239
   943
              </td>
richt@239
   944
            </tr>
richt@239
   945
          </tbody>
richt@239
   946
        </table>
richt@239
   947
      </section>
richt@239
   948
    </section>
richt@239
   949
    <section>
richt@239
   950
      <h2>
richt@239
   951
        Service Discovery
richt@239
   952
      </h2>
richt@239
   953
      <p>
richt@243
   954
        A <a>user agent</a> conforming to this specification MAY implement <abbr title=
richt@243
   955
        "Simple Service Discovery Protocol">SSDP</abbr> [[!UPNP-DEVICEARCH11]] and Zeroconf [[!DNS-SD]] + [[!MDNS]]
richt@250
   956
        <dfn>service discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to
richt@250
   957
        enable Web pages to request and connect with HTTP services running on networked devices, discovered via either
richt@250
   958
        mechanism, through this API. When a <a>user agent</a> implements either of these <a>service discovery
richt@250
   959
        mechanisms</a>, then it MUST conform to the corresponding algorithms provided in this section of the
richt@250
   960
        specification.
richt@239
   961
      </p>
richt@239
   962
      <p>
richt@250
   963
        This section presents how the results of these two <a>service discovery mechanisms</a> will be matched to
richt@250
   964
        requested service types, how the user agent stores available and active services, how their properties are
richt@250
   965
        applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
richt@239
   966
      </p>
richt@239
   967
      <p>
richt@250
   968
        It is expected that user agents will perform these <a>service discovery mechanisms</a> asynchronously and
richt@250
   969
        periodically update the <a>list of available service records</a> as required. The timing of any <a>service
richt@250
   970
        discovery mechanisms</a> is an implementation detail left to the discretion of the implementer (e.g. by
richt@250
   971
        continuously monitoring the network as a background process or on invocation of this API from a Web page).
richt@239
   972
      </p>
richt@239
   973
      <p>
richt@239
   974
        The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents
richt@239
   975
        that is used to track all the services that have been discovered and are available in the current network at
richt@250
   976
        any given time. At any point during the running of either of the two <a>service discovery mechanisms</a> then
richt@250
   977
        existing entries within this table can be updated, entries can be added and entries can be removed as the
richt@250
   978
        status of networked services changes according to the rules defined in this specification.
richt@239
   979
      </p>
richt@239
   980
      <p>
richt@250
   981
        The <dfn>list of active service managers</dfn> is an internal list within user agents that is used to track all
richt@250
   982
        <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages
richt@250
   983
        at the current time. Each <a href="#networkservices"><code>NetworkServices</code></a> object in the <a>list of
richt@250
   984
        active service managers</a> represents a collection of one or more <a href=
richt@250
   985
        "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn>indexed properties</dfn>.
richt@250
   986
        <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a>indexed properties</a>
richt@250
   987
        of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href=
richt@239
   988
        "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm.
richt@239
   989
      </p>
richt@239
   990
      <p>
richt@239
   991
        The rule for <dfn>adding an available service</dfn> is the process of adding a new service or updating an
richt@239
   992
        existing service in the <a>list of available service records</a> that is generally available on the user's
richt@239
   993
        current network. This rule takes one argument, <var>network service record</var>, and consists of running the
richt@239
   994
        following steps:
richt@239
   995
      </p>
richt@239
   996
      <ol class="rule">
richt@239
   997
        <li>Let <var>new service registration flag</var> be <code>true</code>.
richt@239
   998
        </li>
richt@239
   999
        <li>For each <var>existing service record</var> in the current <a>list of available service records</a>, run
richt@239
  1000
        the following sub-steps:
richt@239
  1001
          <ol class="rule">
richt@239
  1002
            <li>If the <var>existing service record</var>'s <code>id</code> property does not equal <var>network
richt@239
  1003
            service record</var>'s <code>id</code> property then abort any remaining sub-steps and continue at the next
richt@239
  1004
            available <var>existing service record</var>.
richt@239
  1005
            </li>
richt@239
  1006
            <li>Set <var>new service registration flag</var> to <code>false</code>.
richt@239
  1007
            </li>
richt@239
  1008
            <li>Replace the value of <var>existing service record</var> in the current <a>list of available service
richt@239
  1009
            records</a> with the value of <var>network service record</var>.
richt@239
  1010
            </li>
richt@239
  1011
          </ol>
richt@239
  1012
        </li>
richt@239
  1013
        <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service
richt@250
  1014
        record</var> to the <a>list of available service records</a> as a new item.
richt@239
  1015
        </li>
richt@250
  1016
        <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following steps:
richt@239
  1017
          <ol class="rule">
richt@250
  1018
            <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
richt@239
  1019
            </li>
richt@250
  1020
            <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
richt@250
  1021
              <ol class="rule">
richt@250
  1022
                <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active
richt@250
  1023
                service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active
richt@250
  1024
                service</var> and continue at the next available <var>active service</var>.
richt@250
  1025
                </li>
richt@250
  1026
                <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
richt@250
  1027
                </li>
richt@250
  1028
                <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network
richt@250
  1029
                service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code>
richt@250
  1030
                attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a>
richt@250
  1031
                attribute is currently set to <code>false</code> then set <var>active service</var>'s <a href=
richt@250
  1032
                "#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href=
richt@250
  1033
                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@250
  1034
                      class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
richt@250
  1035
                      "#event-serviceonline"><code>serviceonline</code></a> that uses the <a href=
richt@250
  1036
                      "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@250
  1037
                      class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
richt@250
  1038
                      and has no default action, at the current <var>active service</var> object.
richt@250
  1039
                </li>
richt@250
  1040
              </ol>
richt@250
  1041
            </li>
richt@250
  1042
            <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type
richt@250
  1043
            in current service manager flag</var> is also set to <code>true</code> then increment <var>service
richt@250
  1044
            manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a>
richt@250
  1045
            attribute by <code>1</code> and then <a href=
richt@250
  1046
            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
  1047
                  class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
richt@239
  1048
                  "#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href=
richt@239
  1049
                  "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1050
                  class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and
richt@250
  1051
                  has no default action, at the current <var>service manager</var> object.
richt@239
  1052
            </li>
richt@239
  1053
          </ol>
richt@239
  1054
        </li>
richt@239
  1055
      </ol>
richt@239
  1056
      <p>
richt@239
  1057
        The rule for <dfn>removing an available service</dfn> is the general process of removing a service from the
richt@239
  1058
        <a>list of available service records</a> that has left the user's current network or has otherwise expired.
richt@239
  1059
        This rule takes one argument, <var>service identifier</var>, and consists of running the following steps:
richt@239
  1060
      </p>
richt@239
  1061
      <ol class="rule">
richt@239
  1062
        <li>For each <var>existing service record</var> in the current <a>list of available service records</a>, run
richt@239
  1063
        the following sub-steps:
richt@239
  1064
          <ol class="rule">
richt@239
  1065
            <li>If the <var>existing service record</var>'s <code>id</code> property does not match <var>service
richt@239
  1066
            identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and
richt@239
  1067
            continue at the next available <var>existing service record</var>.
richt@239
  1068
            </li>
richt@239
  1069
            <li>If the <var>existing service record</var>'s <code>type</code> property begins with the DOMString
richt@239
  1070
            "<code>upnp:</code>" and <var>existing service record</var>'s <code>eventsURL</code> property is set then
richt@239
  1071
            run the rule to <a>terminate an existing UPnP Events Subscription</a>, if one is currently active (as a
richt@239
  1072
            result of having previously called <a>setup a UPnP Events Subscription</a> against the current
richt@239
  1073
            <var>existing service record</var>).
richt@239
  1074
            </li>
richt@250
  1075
            <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following
richt@239
  1076
            steps:
richt@239
  1077
              <ol class="rule">
richt@250
  1078
                <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
richt@239
  1079
                </li>
richt@250
  1080
                <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
richt@250
  1081
                  <ol class="rule">
richt@250
  1082
                    <li>If <var>existing service record</var>'s <code>type</code> property does not equal the
richt@250
  1083
                    <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
richt@250
  1084
                    <var>active service</var> and continue at the next available <var>active service</var>.
richt@250
  1085
                    </li>
richt@250
  1086
                    <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
richt@250
  1087
                    </li>
richt@250
  1088
                    <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active
richt@250
  1089
                    service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href=
richt@250
  1090
                    "#dom-networkservice-online"><code>online</code></a> attribute is currently set to
richt@250
  1091
                    <code>true</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code>
richt@250
  1092
                      online</code></a> attribute to <code>false</code> and then <a href=
richt@250
  1093
                      "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@250
  1094
                          class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
richt@250
  1095
                          "#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href=
richt@250
  1096
                          "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@250
  1097
                          class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not
richt@250
  1098
                          cancellable, and has no default action, at the current <var>active service</var>.
richt@250
  1099
                    </li>
richt@250
  1100
                  </ol>
richt@250
  1101
                </li>
richt@250
  1102
                <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then
richt@250
  1103
                decrement <var>service manager</var>'s <a href=
richt@250
  1104
                "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code>
richt@250
  1105
                and then <a href=
richt@239
  1106
                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
  1107
                      class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
richt@239
  1108
                      "#event-serviceunavailable"><code>serviceunavailable</code></a> that uses the <a href=
richt@239
  1109
                      "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1110
                      class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
richt@250
  1111
                      and has no default action, at the current <var>service manager</var> object.
richt@239
  1112
                </li>
richt@239
  1113
              </ol>
richt@239
  1114
            </li>
richt@239
  1115
            <li>Remove <var>existing service record</var> from the current <a>list of available service records</a>.
richt@239
  1116
            </li>
richt@239
  1117
          </ol>
richt@239
  1118
        </li>
richt@239
  1119
      </ol>
richt@239
  1120
      <p>
richt@250
  1121
        User agents SHOULD expire a service record from the <a>list of available service records</a> when its
richt@250
  1122
        <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this condition is met the
richt@250
  1123
        <a>user agent</a> SHOULD run the rule for <a>removing an available service</a>, passing in the expired service
richt@250
  1124
        record's <code>id</code> attribute as the only argument.
richt@239
  1125
      </p>
richt@239
  1126
      <section>
richt@239
  1127
        <h4>
richt@239
  1128
          Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title=
richt@239
  1129
          "Service Discovery">SD</abbr>)
richt@239
  1130
        </h4>
richt@239
  1131
        <p>
richt@239
  1132
          For each DNS response received from a user-agent-initiated Multicast DNS Browse for <abbr title=
richt@239
  1133
          "DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved
richt@250
  1134
          recommended automatic browsing domain [[!MDNS]], the <a>user agent</a> MUST run the following steps:
richt@239
  1135
        </p>
richt@239
  1136
        <ol class="rule">
richt@239
  1137
          <li>Let <var>service mDNS responses</var> be an array of PTR records received by issuing a Multicast DNS
richt@239
  1138
          Browse for PTR records with the name of the current discovered service type.
richt@239
  1139
          </li>
richt@239
  1140
          <li>For each Object <var>service mDNS response</var> in <var>service mDNS responses</var>, run the following
richt@239
  1141
          steps:
richt@239
  1142
            <ol>
richt@239
  1143
              <li>Let <var>network service record</var> be an Object consisting of the following empty properties:
richt@239
  1144
              <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>,
richt@239
  1145
              <code>expiryTimestamp</code>.
richt@239
  1146
              </li>
richt@239
  1147
              <li>Set <var>network service record</var>'s <code>id</code> property to the value of the full PTR Service
richt@239
  1148
              Instance Name [[!MDNS]].
richt@239
  1149
              </li>
richt@239
  1150
              <li>Set <var>network service record</var>'s <code>name</code> property to the value of the PTR Service
richt@239
  1151
              Instance Name's <var>Instance</var> component [[!MDNS]].
richt@239
  1152
              </li>
richt@239
  1153
              <li>Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string
richt@239
  1154
              <code>zeroconf:</code> followed be the value of the PTR Service Instance Name's <var>Service</var>
richt@239
  1155
              component [[!MDNS]].
richt@239
  1156
              </li>
richt@239
  1157
              <li>Set <var>network service record</var>'s <code>url</code> property to the resolvable Service URL
richt@239
  1158
              obtained from performing an DNS-SD Lookup [[!DNS-SD]] of the current service from the PTR record provided
richt@239
  1159
              [[!MDNS]].
richt@239
  1160
              </li>
richt@239
  1161
              <li>Set <var>network service record</var>'s <code>config</code> property to the string value of the
richt@239
  1162
              contents of the first DNS-SD TXT record associated with the <var>service mDNS response</var> as defined
richt@239
  1163
              in [[!DNS-SD]].
richt@239
  1164
              </li>
richt@239
  1165
              <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the
richt@239
  1166
              current date, in UTC timestamp format, plus a value of <code>120</code> seconds.
richt@239
  1167
              </li>
richt@239
  1168
              <li>Run the general rule for <a>adding an available service</a>, passing in the current <var>network
richt@239
  1169
              service record</var> as the only argument.
richt@239
  1170
              </li>
richt@239
  1171
            </ol>
richt@239
  1172
          </li>
richt@239
  1173
        </ol>
richt@239
  1174
      </section>
richt@239
  1175
      <section>
richt@239
  1176
        <h5>
richt@239
  1177
          Simple Service Discovery Protocol (<abbr title="Simple Service Discovery Protocol">SSDP</abbr>)
richt@239
  1178
        </h5>
richt@239
  1179
        <p>
richt@250
  1180
          A user agent that implements UPnP service discovery MUST issue a <dfn>search request for UPnP root
richt@250
  1181
          devices</dfn> against the user's current local network according to the full normative text and timing
richt@250
  1182
          provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [[!UPNP-DEVICEARCH11]].
richt@239
  1183
        </p>
richt@239
  1184
        <p>
richt@250
  1185
          The user agent MUST issue all <a title="search request for UPnP root devices">search requests for UPnP root
richt@250
  1186
          devices</a> with a HTTP request line equal to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to
richt@250
  1187
          the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to
richt@250
  1188
          <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX
richt@250
  1189
          header equal to a <dfn>maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and
richt@250
  1190
          <code>5</code> seconds.
richt@239
  1191
        </p>
richt@239
  1192
        <p>
richt@250
  1193
          The user agent MUST listen for any incoming responses to any <a>search request for UPnP root devices</a>.
richt@239
  1194
        </p>
richt@239
  1195
        <p>
richt@250
  1196
          For each <dfn>HTTP Response</dfn> following an initial <a>search request for UPnP root devices</a> sent on a
richt@240
  1197
          <a>standard UPnP address and port</a> the user agent MUST run the following steps:
richt@239
  1198
        </p>
richt@239
  1199
        <ol class="rule">
richt@239
  1200
          <li>If the <a>HTTP Response</a> is not a HTTP 200 OK response then this response is invalid and the user
richt@250
  1201
          agent MUST discard this response, abort any remaining steps and return. The user agent MAY issue a new
richt@250
  1202
          <a>search request for UPnP root devices</a> as a result of this error occurring.
richt@250
  1203
          </li>
richt@250
  1204
          <li>If the <a>maximum UPnP advertisement response wait time</a> has been exceeded since the initial <a>search
richt@250
  1205
          request for UPnP root devices</a> was sent then the <a>HTTP Response</a> is invalid and the user agent MUST
richt@250
  1206
          discard this response, abort any remaining steps and return. The user agent MAY stop listening for responses
richt@250
  1207
          from the current <a>search request for UPnP root devices</a> as a result of this error occurring. Equally,
richt@250
  1208
          the user agent MAY issue a new <a>search request for UPnP root devices</a> as a result of this error
richt@239
  1209
          occurring.
richt@239
  1210
          </li>
richt@239
  1211
          <li>Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP
richt@239
  1212
          Response</a>, with each key being the name of a HTTP response header and each value being that HTTP response
richt@239
  1213
          header's value.
richt@239
  1214
          </li>
richt@239
  1215
          <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
richt@239
  1216
          <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the
richt@239
  1217
          value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a>HTTP Response</a> is
richt@250
  1218
          invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps and return.
richt@239
  1219
          </li>
richt@250
  1220
          <li>The user agent MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first
richt@250
  1221
          occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var>
richt@250
  1222
          argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device
richt@250
  1223
          identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var>
richt@250
  1224
          (minus the leading string of <code>max-age=</code>) as the <var>device expiry</var> argument.
richt@239
  1225
          </li>
richt@239
  1226
        </ol>
richt@239
  1227
        <p>
richt@250
  1228
          The user agent MUST listen for incoming requests on the <dfn>standard UPnP address and port</dfn> on all
richt@250
  1229
          current local network interface addresses with the port <code>1900</code>.
richt@250
  1230
        </p>
richt@250
  1231
        <p>
richt@250
  1232
          For each <dfn>HTTP Request</dfn> received on a <a>standard UPnP address and port</a> the user agent MUST run
richt@250
  1233
          the following steps:
richt@239
  1234
        </p>
richt@239
  1235
        <ol class="rule">
richt@239
  1236
          <li>If the <a>HTTP Request</a> is not a HTTP NOTIFY request then it is not a valid UPnP Request and the user
richt@250
  1237
          agent MUST discard this request, abort any remaining steps and return.
richt@239
  1238
          </li>
richt@239
  1239
          <li>Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP
richt@239
  1240
          Request</a>, with each key being the name of a HTTP header and each value being that HTTP header's value.
richt@239
  1241
          </li>
richt@239
  1242
          <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
richt@239
  1243
          <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one
richt@239
  1244
          <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then
richt@250
  1245
          the <a>HTTP Request</a> is a malformed UPnP Request and the <a>user agent</a> MUST discard this request,
richt@250
  1246
          abort any remaining steps and return.
richt@239
  1247
          </li>
richt@250
  1248
          <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> then the user agent
richt@250
  1249
          MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first occurrence of
richt@250
  1250
          <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var> argument and the
richt@250
  1251
          first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument
richt@250
  1252
          and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of
richt@250
  1253
          <code>max-age=</code>) as the <var>device expiry</var>.<br>
richt@239
  1254
            <br>
richt@239
  1255
            Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the
richt@250
  1256
            user agent MUST run the rule for <a>removing all services from a registered UPnP Device</a> passing in the
richt@250
  1257
            first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var>
richt@250
  1258
            argument.
richt@239
  1259
          </li>
richt@239
  1260
        </ol>
richt@239
  1261
        <p>
richt@239
  1262
          The rule for <dfn>obtaining a UPnP Device Description File</dfn> is the process of obtaining the contents of
richt@239
  1263
          a standard UPnP Device Description [[!UPNP-DEVICEARCH11]] from a URL-based resource. This rule takes three
richt@239
  1264
          arguments - <var>device descriptor URL</var>, <var>device identifier</var> and <var>device expiry</var> - and
richt@240
  1265
          when called the user agent MUST run the following steps:
richt@239
  1266
        </p>
richt@239
  1267
        <ol class="rule">
richt@239
  1268
          <li>Let <var>device descriptor file</var> contain the contents of the file located at the URL provided in
richt@239
  1269
          <var>device descriptor URL</var> obtained according to the rules defined in 'Section 2.11: Retrieving a
richt@239
  1270
          description using HTTP' in [[!UPNP-DEVICEARCH11]].
richt@239
  1271
          </li>
richt@239
  1272
          <li>If the value provided in <var>device descriptor URL</var> cannot be resolved as a reachable URL on the
richt@250
  1273
          current network or the <var>device descriptor file</var> remains empty then it is invalid and the <a>user
richt@250
  1274
          agent</a> MUST abort any remaining steps and return.
richt@239
  1275
          </li>
richt@239
  1276
          <li>Run the rule for <a>processing a UPnP Device Description File</a>, passing in the current <var>device
richt@239
  1277
          descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments.
richt@239
  1278
          </li>
richt@239
  1279
        </ol>
richt@239
  1280
        <p>
richt@239
  1281
          The rule for <dfn>processing a UPnP Device Description File</dfn> is the process of parsing the contents of a
richt@239
  1282
          standard UPnP Device Description [[!UPNP-DEVICEARCH11]] and registering the UPnP services contained therein
richt@239
  1283
          within the <a>list of available service records</a>.
richt@239
  1284
        </p>
richt@239
  1285
        <p>
richt@239
  1286
          The rule for <a>processing a UPnP Device Description File</a> takes three arguments - <var>device descriptor
richt@250
  1287
          file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent MUST
richt@250
  1288
          run the following steps:
richt@239
  1289
        </p>
richt@239
  1290
        <ol class="rule">
richt@239
  1291
          <li>Let <var>advertised services</var> be a list of all advertised services obtained from the <var>device
richt@239
  1292
          descriptor file</var> containing the value of the first occurrence of the <code>&lt;serviceList&gt;</code>
richt@239
  1293
          element as it is defined in 'Section 2.3: Device Description' in [[!UPNP-DEVICEARCH11]].
richt@239
  1294
          </li>
richt@239
  1295
          <li>For each <code>&lt;service&gt;</code> element - known as an <var>advertised service</var> - in
richt@239
  1296
          <var>advertised services</var> run the following steps:
richt@239
  1297
            <ol class="rule">
richt@239
  1298
              <li>Let <var>network service record</var> be a new Object consisting of the following empty properties:
richt@239
  1299
              <code>id</code>, <code>deviceId</code>, <code>name</code>, <code>type</code>, <code>url</code>,
richt@239
  1300
              <code>eventsUrl</code>, <code>config</code>, <code>expiryTimestamp</code>.
richt@239
  1301
              </li>
richt@239
  1302
              <li>Set <var>network service record</var>'s <code>id</code> property to the concatenated string value of
richt@250
  1303
              the first occurrence of the <code>&lt;UDN&gt;</code> element in the <var>device descriptor file</var>
richt@250
  1304
              with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
richt@239
  1305
              </li>
richt@239
  1306
              <li>Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device
richt@239
  1307
              identifier</var>.
richt@239
  1308
              </li>
richt@239
  1309
              <li>Set <var>network service record</var>'s <code>name</code> property to the string value of the first
richt@239
  1310
              occurrence of the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
richt@239
  1311
              </li>
richt@239
  1312
              <li>Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string
richt@239
  1313
              <code>upnp:</code> followed by the string value of the first occurrence of the <var>advertised
richt@239
  1314
              service</var>'s <code>&lt;serviceType&gt;</code> sub-element.
richt@239
  1315
              </li>
richt@239
  1316
              <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the first
richt@239
  1317
              occurrence of the <var>advertised service</var>'s <code>&lt;controlURL&gt;</code> sub-element.
richt@239
  1318
              </li>
richt@239
  1319
              <li>Set <var>network service record</var>'s <code>config</code> property to the string value of the
richt@239
  1320
              contents of the first occurrence of the <code>&lt;device&gt;</code> element in the <var>device descriptor
richt@239
  1321
              file</var>.
richt@239
  1322
              </li>
richt@239
  1323
              <li>If <var>advertised service</var>'s <code>&lt;eventSubURL&gt;</code> sub-element is not empty, then
richt@239
  1324
              set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first
richt@239
  1325
              occurrence of the <var>advertised service</var>'s <code>&lt;eventSubURL&gt;</code> sub-element.
richt@239
  1326
              Otherwise, do not set <var>network service record</var>'s <code>eventsUrl</code> property.
richt@239
  1327
              </li>
richt@239
  1328
              <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the
richt@239
  1329
              current date, in UTC timestamp format, plus the value of <var>device expiry</var>.
richt@239
  1330
              </li>
richt@239
  1331
              <li>Run the general rule for <a>adding an available service</a>, passing in the current <var>network
richt@239
  1332
              service record</var> as the only argument.
richt@239
  1333
              </li>
richt@239
  1334
            </ol>
richt@239
  1335
          </li>
richt@250
  1336
          <li>If <var>device descriptor file</var> contains a <code>&lt;deviceList&gt;</code> element then for each
richt@250
  1337
          <code>&lt;device&gt;</code> element within <code>&lt;deviceList&gt;</code> - herein known as an <var>embedded
richt@250
  1338
          device descriptor file</var> - the user agent MUST run the rule for <a>processing a UPnP Device Description
richt@250
  1339
          File</a>, passing in the current <var>embedded device descriptor file</var> as the <var>device descriptor
richt@250
  1340
          file</var> argument, along with the current <var>device identifier</var> and <var>device expiry</var>
richt@250
  1341
          arguments.
richt@250
  1342
          </li>
richt@239
  1343
        </ol>
richt@239
  1344
        <p>
richt@239
  1345
          The rule for <dfn>removing all services from a registered UPnP Device</dfn> is the process of removing all
richt@239
  1346
          services associated with a device from the <a>list of available service records</a> that has left the user's
richt@239
  1347
          current network or has otherwise timed out or expired. This rule takes one argument, <var>device
richt@239
  1348
          identifier</var>, and consists of running the following steps:
richt@239
  1349
        </p>
richt@239
  1350
        <ol class="rule">
richt@239
  1351
          <li>For each <var>existing service record</var> in the current <a>list of available service records</a>, run
richt@239
  1352
          the following sub-steps:
richt@239
  1353
            <ol class="rule">
richt@239
  1354
              <li>If the <var>existing service record</var>'s <code>deviceId</code> property does not match <var>device
richt@239
  1355
              identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and
richt@239
  1356
              continue at the next available <var>existing service record</var>.
richt@239
  1357
              </li>
richt@239
  1358
              <li>Run the general rule for <a>removing an available service</a> passing in <var>existing service
richt@239
  1359
              record</var>'s <code>id</code> property as the only argument.
richt@239
  1360
              </li>
richt@239
  1361
            </ol>
richt@239
  1362
          </li>
richt@239
  1363
        </ol>
richt@239
  1364
        <p>
richt@239
  1365
          When the <a>user agent</a> is to <dfn>setup a UPnP Events Subscription</dfn>, it is to run the following
richt@239
  1366
          steps with the current <var>network service record</var> object as defined in 'Section 4.1.2: SUBSCRIBE with
richt@239
  1367
          NT and CALLBACK' in [[!UPNP-DEVICEARCH11]]:
richt@239
  1368
        </p>
richt@239
  1369
        <ol class="rule">
richt@239
  1370
          <li>If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a>user
richt@240
  1371
          agent</a> MUST abort these steps.
richt@239
  1372
          </li>
richt@239
  1373
          <li>Let <var>callback URL</var> be the value of creating a new <a>user-agent generated callback url</a>.
richt@239
  1374
          </li>
richt@239
  1375
          <li>Send a HTTP SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a
richt@239
  1376
          <em>TIMEOUT</em> header with a user-agent defined timeout value (in the form <code>Second-XX</code> where
richt@239
  1377
          <code>XX</code> is the user-agent defined timeout value in seconds) and a <em>CALLBACK</em> header with a
richt@239
  1378
          string value of <var>callback URL</var> towards the <var>network service record</var>'s
richt@239
  1379
          <code>eventsUrl</code> property.
richt@239
  1380
          </li>
richt@250
  1381
          <li>If a non-200 OK response is received from the HTTP SUBSCRIBE request then the <a>user agent</a> MUST
richt@250
  1382
          abort these steps.
richt@239
  1383
          </li>
richt@239
  1384
          <li>On receiving a valid 200 OK response, run the following steps:
richt@239
  1385
            <ol class="rule">
richt@239
  1386
              <li>Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it
richt@239
  1387
              exists.
richt@239
  1388
              </li>
richt@239
  1389
              <li>Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the
richt@239
  1390
              first included <em>TIMEOUT</em> header (minus the leading string of <code>Second-</code>), if it exists.
richt@239
  1391
              </li>
richt@240
  1392
              <li>Run the following steps asynchronously and continue to the step labeled <em>listen</em> below.
richt@239
  1393
              </li>
richt@239
  1394
              <li>
richt@239
  1395
                <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a>user
richt@239
  1396
                agent</a>:
richt@239
  1397
                <ol class="rule">
richt@239
  1398
                  <li>Let <var>current date</var> equal the current UTC date.
richt@239
  1399
                  </li>
richt@239
  1400
                  <li>If <var>current date</var> is less than the <var>timeout date</var> then continue to the step
richt@239
  1401
                  labeled <em>refresh subscription</em> above.
richt@239
  1402
                  </li>
richt@239
  1403
                  <li>Send a HTTP SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback
richt@239
  1404
                  ID</var> and a user-agent defined <em>TIMEOUT</em> header (in the form <code>Second-XX</code> where
richt@239
  1405
                  <code>XX</code> is the user-agent defined timeout value in seconds) towards the <var>network service
richt@239
  1406
                  record</var>'s <code>eventsUrl</code> property.
richt@239
  1407
                  </li>
richt@239
  1408
                  <li>On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first
richt@250
  1409
                  included <em>SID</em> header and set <var>timeout date</var> to the sum of the current UTC date value
richt@250
  1410
                  plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of
richt@250
  1411
                  <code>Second-</code>), if it exists. If the current date is greater than or equal to <var>timeout
richt@250
  1412
                  date</var> then the <a>user agent</a> SHOULD continue from the step labeled <em>refresh
richt@250
  1413
                  subscription</em> above. For all non 200 OK responses the <a>user agent</a> SHOULD continue from the
richt@250
  1414
                  step labeled <em>refresh subscription</em> above.
richt@239
  1415
                  </li>
richt@239
  1416
                </ol>
richt@239
  1417
              </li>
richt@239
  1418
              <li>
richt@239
  1419
                <em>Listen</em>: For each HTTP NOTIFY request received at the <var>callback URL</var> the <a>user
richt@239
  1420
                agent</a> is to run the following steps:
richt@239
  1421
                <ol class="rule">
richt@239
  1422
                  <li>Let <var>content clone</var> be the result of obtaining the message body of the HTTP NOTIFY
richt@250
  1423
                  request. If <var>content clone</var> is empty, then the <a>user agent</a> MUST abort these steps.
richt@239
  1424
                  </li>
richt@239
  1425
                  <li>Let <var>notification event</var> be a new simple event that uses the <a href=
richt@239
  1426
                  "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1427
                        class="externalDFN"><code>Event</code></a> interface with the name <a href=
richt@239
  1428
                        "#event-notify"><code>notify</code></a>, which does not bubble, is not cancellable, and has no
richt@239
  1429
                        default action.
richt@239
  1430
                  </li>
richt@239
  1431
                  <li>Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of
richt@239
  1432
                  <var>content clone</var>.
richt@239
  1433
                  </li>
richt@239
  1434
                  <li>
richt@239
  1435
                    <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
richt@239
  1436
                        class="externalDFN">Queue a task</a> to dispatch <var>notification event</var> at the current
richt@239
  1437
                        <a><code>NetworkService</code></a> object.
richt@239
  1438
                  </li>
richt@250
  1439
                  <li>Return a HTTP 200 OK response to the sender of the HTTP NOTIFY request.
richt@250
  1440
                  </li>
richt@239
  1441
                </ol>
richt@239
  1442
              </li>
richt@239
  1443
            </ol>
richt@239
  1444
          </li>
richt@239
  1445
        </ol>
richt@239
  1446
        <p>
richt@250
  1447
          A <a>user agent</a> can <dfn>terminate an existing UPnP Events Subscription</dfn> at any time for a
richt@250
  1448
          <var>network service record</var> by sending an HTTP UNSUBSCRIBE request - as defined in 'Section 4.1.4:
richt@250
  1449
          Cancelling a subscription with UNSUBSCRIBE' in [[!UPNP-DEVICEARCH11]] - with a HOST header set to that
richt@250
  1450
          <var>active service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback
richt@250
  1451
          ID</var> obtained when the initial <a>setup a UPnP Events Subscription</a> action occurred.
richt@239
  1452
        </p>
richt@239
  1453
      </section>
richt@239
  1454
      <section>
richt@239
  1455
        <h3>
richt@239
  1456
          Network Topology Monitoring
richt@239
  1457
        </h3>
richt@239
  1458
        <div>
richt@180
  1459
          <p>
richt@239
  1460
            When the <a>user agent</a> detects that the user has dropped from their connected network then, for each
richt@250
  1461
            <var>existing service record</var> in the <a>list of available service records</a>, the user agent MUST run
richt@250
  1462
            the general rule for <a>removing an available service</a> passing in each <var>existing service
richt@250
  1463
            record</var>'s <code>id</code> property as the only argument for each call.
richt@180
  1464
          </p>
richt@180
  1465
          <p>
richt@239
  1466
            When the <a>user agent</a> detects that the user has connected to a new network or reconnected to an
richt@250
  1467
            existing network, then it SHOULD restart its discovery mechanisms as defined in the <a href=
richt@250
  1468
            "#service-discovery">Service Discovery</a> section of this specification, maintaining the existing <a>list
richt@250
  1469
            of active service managers</a> currently in use.
richt@180
  1470
          </p>
richt@239
  1471
        </div>
richt@180
  1472
      </section>
richt@239
  1473
    </section>
richt@239
  1474
    <section>
richt@239
  1475
      <h3>
richt@239
  1476
        Events Summary
richt@239
  1477
      </h3>
richt@191
  1478
      <p>
richt@239
  1479
        The following events are dispatched on the <a href="#networkservices"><code>NetworkServices</code></a> and/or
richt@239
  1480
        <a href="#networkservice"><code>NetworkService</code></a> objects:
richt@191
  1481
      </p>
richt@243
  1482
      <table border="1">
richt@180
  1483
        <thead>
richt@180
  1484
          <tr>
richt@180
  1485
            <th>
richt@239
  1486
              <span>Event name</span>
richt@238
  1487
            </th>
richt@238
  1488
            <th>
richt@238
  1489
              <span>Interface</span>
richt@238
  1490
            </th>
richt@238
  1491
            <th>
richt@238
  1492
              <span>Dispatched when...</span>
richt@238
  1493
            </th>
richt@238
  1494
          </tr>
richt@238
  1495
        </thead>
richt@238
  1496
        <tbody>
richt@238
  1497
          <tr>
richt@238
  1498
            <td>
richt@239
  1499
              <dfn id="event-serviceavailable"><code>serviceavailable</code></dfn>
richt@238
  1500
            </td>
richt@238
  1501
            <td>
richt@239
  1502
              <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1503
                  class="externalDFN"><code>Event</code></a>
richt@238
  1504
            </td>
richt@238
  1505
            <td>
richt@238
  1506
              When a new service that matches one of the <a>requested type tokens</a> is found in the current network.
richt@238
  1507
            </td>
richt@238
  1508
          </tr>
richt@238
  1509
          <tr>
richt@238
  1510
            <td>
richt@239
  1511
              <dfn id="event-serviceunavailable"><code>serviceunavailable</code></dfn>
richt@238
  1512
            </td>
richt@238
  1513
            <td>
richt@239
  1514
              <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1515
                  class="externalDFN"><code>Event</code></a>
richt@238
  1516
            </td>
richt@238
  1517
            <td>
richt@239
  1518
              When an existing service that matches one of the <a>requested type tokens</a> gracefully leaves or
richt@239
  1519
              expires from the current network.
richt@238
  1520
            </td>
richt@238
  1521
          </tr>
richt@238
  1522
          <tr>
richt@238
  1523
            <td>
richt@239
  1524
              <dfn id="event-serviceonline"><code>serviceonline</code></dfn>
richt@238
  1525
            </td>
richt@238
  1526
            <td>
richt@239
  1527
              <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1528
                  class="externalDFN"><code>Event</code></a>
richt@238
  1529
            </td>
richt@238
  1530
            <td>
richt@238
  1531
              When a current service renews its service registration within the current network.
richt@238
  1532
            </td>
richt@238
  1533
          </tr>
richt@238
  1534
          <tr>
richt@238
  1535
            <td>
richt@239
  1536
              <dfn id="event-serviceoffline"><code>serviceoffline</code></dfn>
richt@238
  1537
            </td>
richt@238
  1538
            <td>
richt@239
  1539
              <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1540
                  class="externalDFN"><code>Event</code></a>
richt@238
  1541
            </td>
richt@238
  1542
            <td>
richt@238
  1543
              When a current service gracefully leaves or otherwise expires from the current network.
richt@238
  1544
            </td>
richt@238
  1545
          </tr>
richt@238
  1546
          <tr>
richt@238
  1547
            <td>
richt@239
  1548
              <dfn id="event-notify"><code>notify</code></dfn>
richt@238
  1549
            </td>
richt@238
  1550
            <td>
richt@239
  1551
              <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
richt@239
  1552
                  class="externalDFN"><code>Event</code></a>
richt@238
  1553
            </td>
richt@238
  1554
            <td>
richt@239
  1555
              When a valid UPnP Events Subscription Message is received on a <a>user-agent generated callback url</a>
richt@239
  1556
              for a current service. This event never fires for Zeroconf-based services.
richt@238
  1557
            </td>
richt@238
  1558
          </tr>
richt@238
  1559
        </tbody>
richt@238
  1560
      </table>
richt@239
  1561
    </section>
richt@239
  1562
    <section>
richt@239
  1563
      <h3>
richt@239
  1564
        Garbage collection
richt@239
  1565
      </h3>
richt@180
  1566
      <p>
richt@250
  1567
        A user agent MUST only garbage collect a <a><code>NetworkServices</code></a> object and remove its entry from
richt@250
  1568
        the <a>list of active service managers</a> when the user has navigated away from the browsing context in which
richt@250
  1569
        that <a><code>NetworkServices</code></a> object was provided.
richt@250
  1570
      </p>
richt@250
  1571
      <p>
richt@250
  1572
        A user agent MUST NOT garbage collect individual <a><code>NetworkService</code></a> objects until their parent
richt@250
  1573
        <a><code>NetworkServices</code></a> object has been garbage collected.
richt@250
  1574
      </p>
richt@250
  1575
      <p>
richt@250
  1576
        A user agent MUST garbage collect the <a><code>NetworkService</code></a> <a>indexed properties</a> of a
richt@250
  1577
        <a><code>NetworkServices</code></a> object when that <a><code>NetworkServices</code></a> object itself has been
richt@250
  1578
        garbage-collected.
richt@180
  1579
      </p>
richt@239
  1580
    </section>
richt@180
  1581
    <section>
richt@239
  1582
      <h3>
richt@239
  1583
        Use Cases and Requirements
richt@239
  1584
      </h3>
richt@239
  1585
      <p>
richt@239
  1586
        This section covers what the requirements are for this API, as well as illustrates some use cases.
richt@239
  1587
      </p>
richt@180
  1588
      <ul class="rule">
richt@239
  1589
        <li>Once a user has given permission, user agents should provide the ability for Web pages to communicate
richt@239
  1590
        directly with a Local-networked Service.
richt@239
  1591
          <ul class="rule">
richt@239
  1592
            <li>Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the
richt@239
  1593
            programming shown or increasing/decreasing/muting the volume of the Local-networked Device. The Web page
richt@239
  1594
            requests a service type that is known to be implemented by television sets to which it has the application
richt@239
  1595
            logic to communicate. Local devices providing the request service types are discovered and presented to the
richt@239
  1596
            user for authorization. The user selects one or more of the discovered television sets to be accessible to
richt@239
  1597
            the current Web page and then clicks 'Share'. The Web page can now communicate directly with the
richt@239
  1598
            user-authorized Local-networked services.
richt@180
  1599
            </li>
richt@239
  1600
          </ul>
richt@239
  1601
        </li>
richt@239
  1602
        <li>Web pages should be able to communicate with Local-networked Services using the messaging channel supported
richt@239
  1603
        by those Devices.
richt@239
  1604
          <ul class="rule">
richt@239
  1605
            <li>Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user
richt@239
  1606
            can select their Home Media Server type from a drop-down list, at which point the Web page sends a request
richt@239
  1607
            to the user agent to connect with the associated service type of the Home Media Server. The Media Server
richt@239
  1608
            selected implements a Web Socket channel for bi-directional service communication and so the Web page opens
richt@239
  1609
            a web socket to the requested Media Server and can communicate as required via that appropriate channel.
richt@180
  1610
            </li>
richt@239
  1611
          </ul>
richt@239
  1612
        </li>
richt@239
  1613
        <li>Web pages should be able to communicate with Local-networked Services using the messaging format supported
richt@239
  1614
        by those Devices.
richt@239
  1615
          <ul class="rule">
richt@239
  1616
            <li>Example: A Web page advertises that it is capable of interacting with and controlling multiple types of
richt@239
  1617
            Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media
richt@239
  1618
            Servers, at which point the Web page sends a request to the user agent to connect with the associated
richt@240
  1619
            service type (and, optionally, the associated event type) of the Home Media Server. The communication
richt@239
  1620
            protocols supported by Home Media Servers typically vary between UPnP, JSON-RPC, Protocol Buffers or other
richt@239
  1621
            messaging formats depending on the Home Media Server requested. The Web page is able to communicate with
richt@239
  1622
            the user-selected Home Media Server in the messaging format supported by that Device, which, in this
richt@239
  1623
            example is a simple key/value pair text format.
richt@180
  1624
            </li>
richt@239
  1625
          </ul>
richt@239
  1626
        </li>
richt@239
  1627
        <li>Web pages should not be able to communicate with Local-networked Services that have not been authorized by
richt@239
  1628
        the user thereby maintaining the user's privacy.
richt@239
  1629
          <ul class="rule">
richt@239
  1630
            <li>Example: A Web page requests access to one type of Local-networked service. The user authorizes access
richt@239
  1631
            to that particular service. Other services running on that same device, and on other devices within the
richt@239
  1632
            network, should not be accessible to the current Web page.
richt@180
  1633
            </li>
richt@239
  1634
          </ul>
richt@239
  1635
        </li>
richt@239
  1636
        <li>A user should be able to share one or more Local-networked Services based on a particular service type
richt@239
  1637
        request from a Web page.
richt@239
  1638
          <ul class="rule">
richt@239
  1639
            <li>Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As
richt@239
  1640
            such, it makes a request to the user agent to access those services, of which multiple matches are found.
richt@239
  1641
            The user is capable of selecting one or more of the discovered services to share with the Web page. The Web
richt@239
  1642
            page can then implement a drag-and-drop interface for the user to drag specific actions on to one or more
richt@239
  1643
            of the authorized Local-networked Services.
richt@239
  1644
            </li>
richt@239
  1645
          </ul>
richt@239
  1646
        </li>
richt@239
  1647
        <li>User agents should provide an API exposed to script that exposes the features above. The user is notified
richt@239
  1648
        by UI anytime interaction with Local-networked Services is requested, giving the user full ability to cancel or
richt@239
  1649
        abort the transaction. The user selects the Local-networked Services to be connected to the current Web page,
richt@239
  1650
        and can cancel these at any time. No invocations to these APIs occur silently without user intervention.
richt@239
  1651
        </li>
richt@180
  1652
      </ul>
richt@180
  1653
    </section>
richt@239
  1654
    <section class="informative appendix">
richt@239
  1655
      <h3>
richt@239
  1656
        Examples
richt@239
  1657
      </h3>
richt@239
  1658
      <div class="example">
richt@239
  1659
        <p>
richt@239
  1660
          This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a
richt@239
  1661
          network service. The user may also select multiple network services. When the user has authorized a network
richt@239
  1662
          service to be connected to the web page then the web page issues a simple command to get a list of all the
richt@239
  1663
          albums stored on the connected media player service.
richt@239
  1664
        </p>
richt@239
  1665
        <p>
richt@239
  1666
          The button is re-enabled only when the connected network service disconnects for whatever reason (the service
richt@239
  1667
          becomes unavailable on the network, the user disconnects from their current network or the user revokes
richt@239
  1668
          access to the service from the current web page). At this point the user can re-click the button to select a
richt@239
  1669
          new network service to connect to the web page and the above steps are repeated.
richt@239
  1670
        </p>
richt@239
  1671
        <p>
richt@239
  1672
          The provided service type identifier and service interaction used in this example is based on the
richt@239
  1673
          well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media
richt@239
  1674
          Server</a>.
richt@239
  1675
        </p>
richt@239
  1676
        <hr>
richt@239
  1677
        <pre class="highlight">
richt@239
  1678
&lt;input type="button" value="Start" onclick="start()" id="startBtn"/&gt;
richt@239
  1679
&lt;div id="debugconsole"&gt;&lt;/div&gt;
richt@180
  1680
richt@239
  1681
&lt;script&gt;
richt@180
  1682
 var startBtn = document.getElementById('startBtn'),
richt@180
  1683
     debug = document.getElementById('debugconsole');
richt@180
  1684
richt@180
  1685
 function start() {
richt@180
  1686
   if(navigator.getNetworkServices) {
richt@180
  1687
      navigator.getNetworkServices('zeroconf:_xbmc-jsonrpc._tcp', gotXBMCService, error);
richt@180
  1688
      startBtn.disabled = true;
richt@180
  1689
   } else {
richt@191
  1690
      debug.innerHTML += "&lt;br&gt;Service Discovery not supported!";
richt@180
  1691
   }
richt@180
  1692
 }
richt@180
  1693
richt@180
  1694
 function gotXBMCService(services) {
richt@180
  1695
richt@180
  1696
// Listen for service disconnect messages
richt@180
  1697
richt@191
  1698
   services[0].addEventListener('serviceoffline', function ( e ) {
richt@239
  1699
       debug.innerHTML += "&lt;br&gt;" + services[0].name + " disconnected.";
richt@180
  1700
       startBtn.disabled = false;
richt@180
  1701
   }, false);
richt@180
  1702
richt@180
  1703
// Send a service message to get albums list (and process the service response)
richt@180
  1704
richt@180
  1705
   var svcXhr = new XMLHttpRequest();
richt@240
  1706
   svcXhr.open("POST", services[0].url + "/getAlbums"); // services[0].url and its sub-resources have been
richt@180
  1707
                                                        // whitelisted for cross-site XHR use in this
richt@180
  1708
                                                        // current browsing context.
richt@180
  1709
richt@180
  1710
   svcXhr.setRequestHeader('Content-Type', 'application/json-rpc');
richt@180
  1711
richt@180
  1712
   svcXhr.addEventListener('readystatechange', function ( response ) {
richt@180
  1713
     if( response.readyState != 4 || response.status != 200 )
richt@180
  1714
        return;
richt@239
  1715
     debug.innerHTML += "&lt;br&gt;" + services[0].name + " response received: ";
richt@180
  1716
     debug.textContent += JSON.parse(response.responseText);
richt@180
  1717
   }, false);
richt@180
  1718
richt@180
  1719
   var svcMsg = [
richt@180
  1720
     { "jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": { "genreid": -1,
richt@180
  1721
         "artistid": -1, "start": -1, "end": -1 }, "id": "1" }
richt@180
  1722
   ];
richt@180
  1723
richt@180
  1724
   svcXhr.send(JSON.stringify(svcMsg));
richt@239
  1725
   debug.innerHTML += "&lt;br&gt;" + services[0].name + " request sent: ";
richt@180
  1726
   debug.textContent += JSON.stringify(svcMsg);
richt@180
  1727
richt@180
  1728
 }
richt@180
  1729
richt@180
  1730
 function error( err ) {
richt@239
  1731
   debug.innerHTML += "&lt;br&gt;An error occurred obtaining a local network service.";
richt@180
  1732
   startBtn.disabled = false;
richt@180
  1733
 }
richt@239
  1734
&lt;/script&gt;
richt@239
  1735
</pre>
richt@239
  1736
      </div>
richt@239
  1737
      <div class="example">
richt@239
  1738
        <p>
richt@239
  1739
          This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user
richt@239
  1740
          selects an audio device from the list provided, they are prompted to authorize a network service based on the
richt@239
  1741
          service type requested. The user may also select multiple network services matching the selected service
richt@239
  1742
          type. In this example, the user selects their make as being <var>Sony</var> and their model as being
richt@239
  1743
          <var>Bravia S1000</var> from which the Web page can derive a service type
richt@239
  1744
          (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).<br>
richt@239
  1745
          <br>
richt@239
  1746
          Once the user has authorized the device, the web page sends a simple mute command according to the messaging
richt@239
  1747
          format supported by the device.
richt@239
  1748
        </p>
richt@239
  1749
        <hr>
richt@239
  1750
        <pre class="highlight">
richt@239
  1751
&lt;select name="make" id="make"&gt;
richt@180
  1752
  &lt;option selected="selected" disabled="disabled"&gt;Select make&lt;/option&gt;
richt@180
  1753
  &lt;option&gt;Sony&lt;/option&gt;
richt@180
  1754
  &lt;option&gt;Philips&lt;/option&gt;
richt@180
  1755
  &lt;option&gt;Alba&lt;/option&gt;
richt@180
  1756
&lt;/select&gt;
richt@180
  1757
&lt;select name="model" id="model"&gt;&lt;/select&gt;
richt@180
  1758
&lt;div id="debugconsole"&gt;&lt;/div&gt;
richt@180
  1759
richt@180
  1760
&lt;script&gt;
richt@180
  1761
  var debug = document.getElementById('debugconsole');
richt@180
  1762
richt@180
  1763
  var models = {
richt@180
  1764
    "Sony": [
richt@180
  1765
      {"name": "Bravia TV S1000", "type": "upnp", "service": "urn:schemas-upnp-org:service:RenderingControl:1" },
richt@180
  1766
      {"name": "Bravia TV S2000", "type": "zeroconf", "service": "_mediarenderer._http._tcp" },
richt@180
  1767
      {"name": "HiFi WD10", "type": "upnp", "service": "urn:schemas-upnp-org:service:RenderingControl:1" }
richt@180
  1768
    ],
richt@180
  1769
    "Philips": [ /* ... */ ],
richt@180
  1770
    "Alba": [ /* ... */ ]
richt@180
  1771
  };
richt@180
  1772
richt@180
  1773
  var makeEl = document.getElementById("make"),
richt@180
  1774
      modelEl = document.getElementById("model");
richt@180
  1775
richt@180
  1776
  makeEl.addEventListener('change', function() {
richt@180
  1777
    modelEl.innerHTML = ""; // reset
richt@180
  1778
    var defaultOption = document.createElement("option");
richt@180
  1779
    defaultOption.textContent = "Select model";
richt@180
  1780
    defaultOption.setAttribute("disabled", "disabled");
richt@180
  1781
    defaultOption.setAttribute("selected", "selected");
richt@180
  1782
    modelEl.appendChild(defaultOption);
richt@239
  1783
    for(var i = 0, l = models[makeEl.value].length; i &lt; l; i++) {
richt@180
  1784
      var option = document.createElement("option");
richt@180
  1785
      option.textContent = models[makeEl.value][i]["name"];
richt@180
  1786
      option.setAttribute("value", models[makeEl.value][i]["type"] + ":" + models[makeEl.value][i]["service"]);
richt@180
  1787
      modelEl.appendChild(option);
richt@180
  1788
    }
richt@180
  1789
  }, false);
richt@180
  1790
richt@180
  1791
  modelEl.addEventListener('change', function() {
richt@239
  1792
    if(navigator.getNetworkServices &amp;&amp;
richt@180
  1793
         modelEl.value == "upnp:urn:schemas-upnp-org:service:RenderingControl:1") {
richt@180
  1794
      navigator.getNetworkServices(modelEl.value, successCallback, errorCallback);
richt@180
  1795
    } else if (modelEl.value == "zeroconf:_mediarenderer._http._tcp") {
richt@180
  1796
      debug.innerHTML += "&lt;br&gt;Service type is not implemented by this application.";
richt@180
  1797
    } else {
richt@180
  1798
      debug.innerHTML += "&lt;br&gt;Service Discovery is not supported!";
richt@180
  1799
    }
richt@180
  1800
  }, false);
richt@180
  1801
&lt;/script&gt;
richt@180
  1802
richt@180
  1803
&lt;script&gt;
richt@180
  1804
  function successCallback( services ) {
richt@180
  1805
richt@191
  1806
  // Listen for service push notification messages
richt@180
  1807
richt@191
  1808
    services[0].addEventListener('notify', function ( msg ) {
richt@239
  1809
         debug.innerHTML += "&lt;br&gt;" + services[0].name + " event received: ";
richt@180
  1810
         debug.textContent += msg.data;
richt@180
  1811
    }, false);
richt@180
  1812
richt@180
  1813
 // Send a control signal to mute the service audio
richt@180
  1814
richt@180
  1815
    var svcXhr = new XMLHttpRequest();
richt@180
  1816
    svcXhr.open("POST", services[0].url); // services[0].url and its
richt@240
  1817
                                          // sub-resources have been whitelisted for
richt@180
  1818
                                          // cross-site XHR use in this current
richt@180
  1819
                                          // browsing context.
richt@180
  1820
richt@180
  1821
    svcXhr.setRequestHeader('SOAPAction', 'urn:schemas-upnp-org:service:RenderingControl:1#SetMute');
richt@180
  1822
    svcXhr.setRequestHeader('Content-Type', 'text/xml; charset="utf-8";');
richt@180
  1823
richt@180
  1824
    svcXhr.onreadystatechange = function ( response ) {
richt@180
  1825
      if( response.readyState != 4 || response.status != 200 )
richt@180
  1826
        return;
richt@180
  1827
      debug.innerHTML += "&lt;br&gt;" + services[0].name + " response received: ";
richt@180
  1828
      debug.textContent += response.responseXML;
richt@180
  1829
    }
richt@180
  1830
richt@180
  1831
    // Service messaging to mute the provided service
richt@180
  1832
    var svcMsg = '&lt;?xml version="1.0" encoding="utf-8"?&gt;' +
richt@180
  1833
                 '&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
richt@180
  1834
                   'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;' +
richt@180
  1835
                   '&lt;s:Body&gt;' +
richt@180
  1836
                     '&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;' +
richt@180
  1837
                       '&lt;InstanceID&gt;0&lt;/InstanceID&gt;' +
richt@180
  1838
                       '&lt;Channel&gt;Master&lt;/Channel&gt;' +
richt@180
  1839
                       '&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;' +
richt@180
  1840
                     '&lt;/u:SetMute&gt;' +
richt@180
  1841
                   '&lt;/s:Body&gt;' +
richt@180
  1842
                 '&lt;/s:Envelope&gt;';
richt@180
  1843
richt@180
  1844
    svcXhr.send(svcMsg);
richt@180
  1845
    debug.innerHTML += "&lt;br&gt;" + services[0].name + " request sent: ";
richt@180
  1846
    debug.textContent += svcMsg;
richt@180
  1847
  }
richt@180
  1848
richt@180
  1849
  function errorCallback( error ) {
richt@180
  1850
    debug.innerHTML += "&lt;br&gt;An error occurred: " + error.code;
richt@180
  1851
  }
richt@239
  1852
&lt;/script&gt;
richt@239
  1853
</pre>
richt@239
  1854
      </div>
richt@239
  1855
    </section>
richt@180
  1856
    <section>
richt@239
  1857
      <h3>
richt@239
  1858
        Acknowledgements
richt@239
  1859
      </h3>
richt@239
  1860
      <p>
richt@239
  1861
        Thanks are expressed by the editor to the following individuals for their feedback on this specification to
richt@239
  1862
        date (in alphabetical order):<br>
richt@239
  1863
        <br>
richt@239
  1864
        Gar Bergstedt, Lars-Erik Bolstad, Cathy Chan, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides,
richt@239
  1865
        Clarke Stevens, Christian Söderström, Mark Vickers.
richt@239
  1866
      </p>
richt@239
  1867
      <p>
richt@239
  1868
        Thanks are also expressed by the editor to the following organizations and groups for their support in
richt@239
  1869
        producing this specification to date (in alphabetical order):<br>
richt@239
  1870
        <br>
richt@239
  1871
        CableLabs, Opera Software ASA, W3C Device APIs Working Group, W3C Web and TV Interest Group.
richt@239
  1872
      </p>
richt@180
  1873
    </section>
richt@239
  1874
  </body>
richt@180
  1875
</html>