naggie / sd01

Minimal service discovery with strict implementation. You should probably use mDNS.
MIT License
6 stars 2 forks source link

GetServices method for go implementation #8

Closed naggie closed 6 years ago

naggie commented 6 years ago

In addition to or as an alternative to the discoveries channel

The implementation should return services which are currently "alive" like th python implementation

jimjibone commented 6 years ago

I was thinking about this last night, actually. I was thinking we could create an alternative non-channel based version of Discoverer. Possibly renaming the current one to ChanneledDiscoverer.

naggie commented 6 years ago

I think we should agree on a single implementation, maybe similar to the python one. What makes sense in real use matters most though, I have not tried it yet but I think the original design at least suits dspa, signage etc

jimjibone commented 6 years ago

I think it's best that we stick to a single implementation too. Similar to the Python one is fine and should be easy/logical to use.

If you don't mind, I'll modify my fork to implement a GetServices method which returns a list of recently discovered services, removing old ones after some timeout.

Do you have a specific timeout in mind? Or let the user decide?

jimjibone commented 6 years ago

I have implemented this now and submitted the PR. Let me know what you think.

naggie commented 6 years ago

The timeout is double the heartbeat interval according to the protocol (assuming I wrote it down haha).

(edit: I see you've done that. Great!)

You beat me to it. Thanks!

jimjibone commented 6 years ago

Oh yeah, I did find that in the end and forgot to mention it haha.