replacing scanning by mDNS / DNS-SD #28

Open
opened 2025-09-19 20:04:29 +02:00 by utopiah · 1 comment
Owner

Replace scanpeers() in index.js#L253 by mDNS / DNS-SD thanks to bonjour cf e.g. ~/Prototypes/aframe_bonjour_simplified_backend with

const os = require('os')
var instance = require('bonjour')()

const port = process.env.PORT || 8443
process.title = "aframe-server"; // Set process name

instance.publish({ name: 'aframe-server-'+os.hostname(), type: 'https', port: port })
instance.find({ type: 'https' }, function (service) {
  console.log('Found an HTTPS server:', service)
})

const webdav = require('webdav-server').v2
const express = require('express')

example, namely being able to keep port and IP entirely dynamic on LAN and get instantaneous results without scanning.

Replace `scanpeers()` in `index.js#L253` by mDNS / DNS-SD thanks to `bonjour` cf e.g. `~/Prototypes/aframe_bonjour_simplified_backend` with ```javascript const os = require('os') var instance = require('bonjour')() const port = process.env.PORT || 8443 process.title = "aframe-server"; // Set process name instance.publish({ name: 'aframe-server-'+os.hostname(), type: 'https', port: port }) instance.find({ type: 'https' }, function (service) { console.log('Found an HTTPS server:', service) }) const webdav = require('webdav-server').v2 const express = require('express') ``` example, namely being able to keep port and IP entirely dynamic on LAN and get instantaneous results without scanning.
Author
Owner

Should also help for #13 via down event on service.

Should also help for #13 via `down` event on service.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: utopiah/offline-octopus#28