bonvoyage
seaport is a great service for service discovery on a network, but how do you find the seaport server? Enter mDNS - this lets us broadcast the availability of a seaport server on the network.
Server
To advertise a seaport server, do the following:
var Seaport = bonvoyage = ; // start seaportvar seaport = Seaport;seaport; // publish bonvoyage advertvar bonvoyageServer = ;bonvoyageServer;
Client
To register a service with a seaport server, do the following:
var bonvoyage = ; var bonvoyageClient = ;bonvoyageClient;
If seaport goes away and comes back, the service will be re-registered automagically on the same port with the same role and version without being re-created.
To find a seaport server, do the following:
var bonvoyage = ; var bonvoyageClient = ;bonvoyageClient;
This will fire once when a seaport server is found on the network.
To be notified when seaport goes away and comes back, listen on the client for seaportUp
and seaportDown
events.