Question

I'd like to create a web service that an application server can contact to add itself to a list of servers implementing the application. Clients could then contact the service to get a list of servers. Something similar to how minecraft's heartbeats work for adding your server to the main server list.

I could implement it myself pretty easily, but I'm hoping someone has already created something like this.

Advanced features would be useful. Things like:

  • Allowing a client to perform queries on application-specific properties like the number of users currently connected to the server
  • Distributing the server list across more than one machine
  • Timing out a server's entry in the list if it hasn't sent a heartbeat within some amount of time

Does anyone know of a service like this? I know there are open protocols and servers for doing local-LAN service discovery, but this would be a WAN service.

Was it helpful?

Solution

The protocols I could find that had any relevance to your intended application are these:

The XRDS documentation is obtuse, but you may be able to push service descriptions in XML format. The service type specification might be generic, but I get a headache from trying to decipher committee-speak.

The XMPP Service Discovery protocol (part of the protocol Formerly Known As Jabber) also looked promising, but it seems that even though you could push your service description, they expect it to be one of the services mentioned on this list. Extending it would make it nonstandard.

Finally, I found something called seap (SErvice Announcement Protocol). It's old, it's rickety, the source may be propriety, it's written in C and Perl, it's a kludge, but it seems to do what you want, kind-of.

It seems like pushing a service announcement pulse is such an application-specific and trivial problem, that almost nobody has considered solving the general case.

My advice? Read the protocols and sources mentioned above for inspiration (I'd start with seap), and then write, implement, and publish a generic (probably xml-based) protocol yourself. All the existing ones seem to be either application-specific, incomprehensible, or a kludge.

OTHER TIPS

Basically, you can write it yourself though I am not aware if anyone has one for public (I wrote one over 10 yrs ago, but for a company).

  • database (TableCols: auto-counter, svr_name, svr_ip, check_in_time, any-other-data)
  • code to receive heartbeat (http://<you-app.com>?svr_name=XYZ&svr_ip=P.Q.R.S)
  • code to list out servers within certain check_in_time
  • code to do some housecleaning once a while (eg: purge old records)

To send a heartbeat out, you only need to send a http:// call, on Linux use wget* with crontab, on windows use wget.exe with task scheduler.

It is application specific, so even if you wrote one yourself, others can't use it without modifying the source code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top