{"action":"opened","issue":{"url":"https://api.github.com/repos/agnat/node_mdns/issues/166","repository_url":"https://api.github.com/repos/agnat/node_mdns","labels_url":"https://api.github.com/repos/agnat/node_mdns/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/agnat/node_mdns/issues/166/comments","events_url":"https://api.github.com/repos/agnat/node_mdns/issues/166/events","html_url":"https://github.com/agnat/node_mdns/issues/166","id":154280778,"number":166,"title":"Provide isSame() or equivalent method to service","user":{"login":"ajmas","id":682269,"avatar_url":"https://avatars.githubusercontent.com/u/682269?v=3","gravatar_id":"","url":"https://api.github.com/users/ajmas","html_url":"https://github.com/ajmas","followers_url":"https://api.github.com/users/ajmas/followers","following_url":"https://api.github.com/users/ajmas/following{/other_user}","gists_url":"https://api.github.com/users/ajmas/gists{/gist_id}","starred_url":"https://api.github.com/users/ajmas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajmas/subscriptions","organizations_url":"https://api.github.com/users/ajmas/orgs","repos_url":"https://api.github.com/users/ajmas/repos","events_url":"https://api.github.com/users/ajmas/events{/privacy}","received_events_url":"https://api.github.com/users/ajmas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-11T16:02:50Z","updated_at":"2016-05-11T16:02:50Z","closed_at":null,"body":"When browsing for services the 'serviceUp' event will also return instances matching the locally started advertisements. It would be useful to have a way to find out if a discovered service is equal to one of the locally started services. I didn't see anything equivalent when I looked through the docs.\r\n\r\nI am thinking something along the lines of:\r\n\r\n```\r\nif (!service.isSame(myAdvertisements)) {\r\n    // do stuff\r\n}\r\n```\r\n\r\nCurrently in my own code I have the following, but fear it may suffer numerous edge cases:\r\n\r\n```\r\nbrowser.on('serviceUp', function(service) {\r\n  console.log(\"service up: \", service);\r\n  if ((service.host == os.hostname() || service.host == (os.hostname() + '.')) && listeningPort) {\r\n      console.log('matching host');\r\n  } else {\r\n      console.log('NOT matching host', service.host, os.hostname());\r\n  }\r\n});\r\n```\r\n\r\nFailing an API change, what approach would you use to match a local advertisement to a discovered service?\r\n"}}