-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
With node.js' dgram socket you can listen to the 'listening' event to ensure the socket is correctly bound to:
import { createSocket } from 'node:dgram'
const socket = createSocket('udp4')
socket.on('message', (message, rinfo) => {
//...
})
socket.on('listening', () => {
console.log(`log receiver listening at ${address.address}:${address.port}`)
})
socket.bind(9871, '0.0.0.0')It would be nice to have similar functionality in the LogReceiver. Suggested API:
const receiver = new LogReceiver({
address: "0.0.0.0",
port: 9871,
});
await receiver.start(); // bind the socket and resolves when the 'listening' event is emittedor
const receiver = new LogReceiver({
address: "0.0.0.0",
port: 9871,
});
await receiver.listening; // resolves when the 'listening' event is emitted or resolves immediately if the socket is already boundMetadata
Metadata
Assignees
Labels
No labels