Re: Discovery API proposals: call for comments

N.V.Balaji wrote:
>>>
>>> 2. As I understand the type to be used in getNetworkServices depends on
>>> the external standards being used by the service provider. As a web
>>> programmer, how do I detect a TV without knowing specific protocol being
>>> used by the service provider. Am I supposed to invoke getNetworkServices
>>> twice with different types?
>>
>> Currently, that is the expected behavior.
>>
>> We _could_ allow web pages to request more than one service type in
>> the getNetworkServices 'type' argument. So you could request multiple
>> service types from the network. In the NetworkService result we would
>> echo the service type that the user selected in a 'type' attribute.
>>
>> Something like the follows:
>>
>> navigator.getNetworkServices(['_boxee-jsonrpc._tcp',
>> '_xbmc-jsonrpc._tcp'], success);
>>
>> function success( services ) {
>> for(var i in services) {
>> var serviceType = services[i].type;
>> if(serviceType == '_boxee-jsonrpc._tcp') {
>> // communicate with Boxee's JSON-RPC API via services[i].url
>> } else {
>> // communicate with XBMC's JSON-RPC API via services[i].url
>> }
>> }
>> }
>>
>
> [NVB]: This works given that we have only 2 discovery protocols.

I've updated the Opera proposal to include this behavior.

Many thanks,

Rich

Received on Thursday, 22 September 2011 14:37:16 UTC