Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/bonjour

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/bonjour

TypeScript definitions for bonjour

  • 3.5.13
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.4M
increased by7.68%
Maintainers
1
Weekly downloads
 
Created

What is @types/bonjour?

@types/bonjour provides TypeScript definitions for the bonjour package, which is used for zero-configuration networking using multicast DNS (mDNS) service discovery. It allows you to publish and discover services on a local network without any configuration.

What are @types/bonjour's main functionalities?

Publishing a Service

This feature allows you to publish a service on the local network. In this example, a web server service is published on port 3000.

const bonjour = require('bonjour')();
const service = bonjour.publish({ name: 'My Web Server', type: 'http', port: 3000 });
service.start();

Browsing for Services

This feature allows you to browse for services of a specific type on the local network. In this example, it searches for HTTP servers and logs the details of any found services.

const bonjour = require('bonjour')();
bonjour.find({ type: 'http' }, function (service) {
  console.log('Found an HTTP server:', service);
});

Stopping a Service

This feature allows you to stop a published service. In this example, the previously published web server service is stopped.

const bonjour = require('bonjour')();
const service = bonjour.publish({ name: 'My Web Server', type: 'http', port: 3000 });
service.start();
// Later, stop the service
service.stop();

Unpublishing All Services

This feature allows you to unpublish all services that have been published by the bonjour instance. In this example, two services are published and then all services are unpublished.

const bonjour = require('bonjour')();
// Publish some services
const service1 = bonjour.publish({ name: 'Service1', type: 'http', port: 3000 });
const service2 = bonjour.publish({ name: 'Service2', type: 'http', port: 3001 });
service1.start();
service2.start();
// Unpublish all services
bonjour.unpublishAll();

Other packages similar to @types/bonjour

FAQs

Package last updated on 07 Nov 2023

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