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

lms-discovery

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lms-discovery

Logitech Media Server discovery for Node.js

1.0.0
Source
npm
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

lms-discovery

Logitech Media Server discovery for Node.js

Install

npm install --save lms-discovery

Usage

// ESM
import discovery from 'lms-discovery';
// CJS
const discovery = require('lms-discovery');

discovery.on('discovered', (server) => {
    console.log('Server discovered:', server);
});

discovery.on('lost', (server) => {
    // Do something with lost server
});

discovery.start();

...

discovery.stop();


// Output
Server discovered: {
    ip: '192.168.1.85',     // Server's IP address
    name: 'my-lms-server',  // Server name
    ver: '8.2.1',           // Server version
    uuid: '187fa185-d108-408b-a8bd-8f5a4bb855bd',  // Unique identifier
    jsonPort: '9000',       // Port for JSON-RPC requests
    cliPort: '9090'         // Port for CLI commands and queries   
}

Run example:

npm run example

API

start([options])

Starts the discovery service.

Params

  • options: (optional and all properties optional)
    • broadcastAddress: (string) network address used to transmit discovery requests. Default: 255.255.255.255.
    • discoveredTTL: (number) how long in milliseconds to wait for a discovered server to respond to a subsqeuent discovery request before it is presumed lost. Default: 60000 (60 seconds).
    • discoverInterval: (number) how often in milliseconds to broadcast discovery requests. Default: 30000 (30 seconds).

discoveredTTL must be larger than discoverInterval.

stop()

Stops the discovery service.

getStatus()

Gets the status of the discovery service.

Returns

running or stop

getAllDiscovered()

Gets all servers discovered so far.

Returns

Array<ServerInfo>

setDebug(enabled[, callback])

Whether to enable debug messages.

Params

  • enabled: (boolean)
  • callback: (function)
    • If specified, debug messages will be passed to callback.
    • If not specified, debug messages will be printed to console.

Events

on('discovered', (server) => ...)

Emitted when a server is discovered.

Listener Params

on('lost', (server) => ...)

Emitted when a server is presumed lost, i.e. when it no longer responds to discovery requests within the default or discoveredTTL period passed to start().

Listener Params

on('error', (error) => ...)

Emitted when an error has occurred.

Listener Params

  • error: (any)

Changelog

1.0.0:

  • Migrate to TypeScript and package as ESM / CJS hybrid module

0.1.0:

  • Initial release

License

MIT

Keywords

logitech media server

FAQs

Package last updated on 11 Jul 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