Socket
Socket
Sign inDemoInstall

@ionic/discover

Package Overview
Dependencies
Maintainers
13
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ionic/discover

Simple UDP based protocol for service discovery implemented in pure JS. Not mDNS or bonjour.


Version published
Weekly downloads
12K
decreased by-3.26%
Maintainers
13
Weekly downloads
 
Created
Source

Ionic Discover

Simple UDP based protocol for service discovery implemented in pure JS. It is not mDNS or bonjour, but it tries to accomplish the same thing.

Spec

It uses a JSON based textual format:

const message = {
  t: now,
  id: this.id,
  name: this.name,
  host: os.hostname(),
  ip: iface.address,
  port: this.port
};
return 'ION_DP' + JSON.stringify(message);
  • t: unix timestamp in second
  • id: unique id for this session
  • name: name of the announced service
  • host: hostname of the machine announcing the service
  • ip: ipv4 address
  • port: tcp port of the announced service

Why?

Complexity of mDNS and lack of good pure JS implementations. We tried different NPM packages that implemented mDNS, ZeroConf or Bonjour but non of them worked for us:

  • mdns: it worked very realiably, but required compiling C code with dependencies. It required complicated and different instructions steps for osx, windows and linux
  • node-bonjour: buggy
  • node-mdns: buggy

We were in a dead end road with the approach and trying to reimplement mDNS by our own was completely out of scope.

Installation

npm install @ionic/discover --save

Usage

const Publisher = require('@ionic/discover').Publisher;
const serviceName = 'Ionic thing!';
const tcpPort = 8100;
const service = new Publisher(serviceName, tcpPort);
service.start();

FAQs

Package last updated on 10 Oct 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