Socket
Socket
Sign inDemoInstall

@ionic/discover

Package Overview
Dependencies
8
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ionic/discover

Simple UDP based protocol for service discovery implemented in pure JS.


Version published
Weekly downloads
13K
decreased by-2.44%
Maintainers
1
Install size
295 kB
Created
Weekly downloads
 

Readme

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: 'unique',
  name: this.name,
  host: os.hostname(),
  ip: iface.address,
  port: number1,
  commPort: number2
};

return 'ION_DP' + JSON.stringify(message);
keydescription
tunix timestamp in second
idunique id for this session
namename of the announced service
hosthostname of the machine announcing the service
ipipv4 address
porttcp port of the announced service
commPortoptional websocket port of the communication server

Installation

npm install @ionic/discover

Usage

import { Publisher } from '@ionic/discover';

const namespace = 'your-service';
const serviceName = 'Ionic thing!';
const tcpPort = 8100;
const service = new Publisher(namespace, serviceName, tcpPort);

await service.start();

FAQs

Last updated on 19 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc