vstirbu / ZeroConf

ZeroConf plugin for Cordova/Phonegap 3.0
MIT License
38 stars 21 forks source link

New Function: List all Services of a specific type #10

Closed neophob closed 9 years ago

vstirbu commented 9 years ago

Great stuff!

I noticed that list requires a timeout value. Wouldn't be better to have a default timeout?

neophob commented 9 years ago

well it depends. the function block for the timeout amount, so I guess it make sense to define a timeout. the main use case for this function is, "gimme all http tcp services you detect in n seconds".

and if you dont need all the services NOW, you can use the watch function.

what do you think about it?

vstirbu commented 9 years ago

I see the need for getting the services at a given time and continue with that set but do not see the point in having a configurable timeout for the same operation as it is equivalent with watching a type and then unwatching after the time out.

Have I misunderstood your scenario?

neophob commented 9 years ago

The watch function does not really work with multiple results - at least in my tests. Besides that I needed all services of a specific type and want to wait n seconds. Implementation wise it's simpler to use the list function instead of watch/unwatch/close.

vstirbu commented 9 years ago

Ok, I think the API should have a default timeout but we can leave determining the the exact value for later