New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

udp-service-discovery

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

udp-service-discovery

Simple and cheap service discovery broadcast and listener

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
decreased by-44.12%
Maintainers
2
Weekly downloads
 
Created
Source

udp-service-discovery

Broadcasts Services via UDP (default every second via port 12345) and listens to them on the client. If listenOnce(servicename) is used, the listening port will be unbound upon recieving a matching service. Client automatically tries to rebind if port is in use, so multiple instances can easyly run on the same host (they will bind one after another).

Example

Server:

var UDPServiceDiscovery = require('../dist/udp-service-discovery.js').UDPServiceDiscovery
var udpDSCV = new UDPServiceDiscovery({port: 8000});

// broadcasts name: 'my-server', ip: null (filled in by library), port: 4321, additional key/value {"protocol": "tcp"}
udpDSCV.broadcast('my-server', null, 4321, {"protocol": "tcp", "other": 42});

Client:

var UDPServiceDiscovery = require('../dist/udp-service-discovery.js').UDPServiceDiscovery
var udpDSCV = new UDPServiceDiscovery({port: 8000});

udpDSCV.listenOnce('my-server');

udpDSCV.on('discovery', function (service) {
    // you would try to connect your client to service.host : service.port
    console.log(service);
});

Keywords

FAQs

Package last updated on 21 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc