simple-mdns-announce
Version:
A NodeJS library to announce services using mdns.
27 lines • 1.09 kB
TypeScript
import type { ITxtRecords } from "./ITxtRecords.js";
export type IService = {
/** The name of the service. */
name: string;
/** The type of the service (e.g., _http._tcp). */
type: string;
/** Optional. The subtype of the service. */
subtype?: string;
/** The port number for the service. */
port: number;
/** Optional. Key-value pairs of additional information you want to associate with the service (e.g., {'key': 'value'}). */
txtRecords?: ITxtRecords;
};
/**
* This function announces a service over mDNS. You pass an IService object with
* the service details. The function returns a cleanup handle that you can call
* to stop the service announcement and kill the underlying dns-sd process.
*
* @param service
* The service to announce.
* @param onError
* An optional error handler. It is used as event handler for the 'error' event
* on the spawned child process.
* @returns
*/
export declare function announceService(service: IService, onError?: (err: Error) => void): () => void;
//# sourceMappingURL=announceService.d.ts.map