etcd-spaceport
Service registry leveraging etcd as a backend
Create a new Registry
var Registry = ; var registry = ;
Specify the etcd base keypath. Services will be registered under this path.
Listen for new services
registry;
When a new service is registered, the callback will be called with a service object. Listen for the offline
event to know when the service goes offline.
Register your service
var service = registry; var details = 'any': 'keys' 'that': 'you want'; // start the serviceservicestartdetails { // started}; // stop a service sometime laterservice;
Some other process can register services into the registry. When you start a service, you can pass service details which will be available to the browsers. These details are stored as a JSON string as the etcd value for the service key.
If there is already a service running with the same name, the start call will fail with and error.