achingbrain / achingbrain/ssdp
byebye message not sent when calling bus.stop()
- Dominant language
- TypeScript
- Stars
- 59
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
HI @achingbrain,
I'm using your library, and integrating it with express, as per your example:
`const upnp = require('@achingbrain/ssdp')(options.ssdpOptions);`
`const ssdp = require('./ssdp/ssdp');`
`upnp.on('error', console.error) // Log errors`
` .advertise(ssdp.services) // Advertise the services configured`
` .then(ssdp.serviceHosting) // Configure Express to serve the details.xml file`
` .then(addRoutes); // then add all the other routes`
where:
- options.ssdpOptions specifies a guid for the udn,
- ssdp.services contains the USN, the location and the details for the service,
- ssdp.serviceHosting contains the routing for express, and
- addRoutes adds all the remaining routes to express.
To get to this point, I needed to modify stop-advert.js slightly. To integrate with express, I need to specify a location, but if the location is specified, no shutdownServers function is created in create-location.js, and an unhandled promise rejection is thrown in stop-advert.js when it tries to call plumbing.shutdownServers. All I'm doing is checking if shutdownServers exists before it's called.
The issue I'm having is when I call upnp.stop(), a transport:outgoing-message is emitted for the byebye, but I never see the corresponding packet in wireshark. The socket.send call never seems to return.
I can submit a PR for the unhandled promise rejection, but I'm stuck on the other issue. Any ideas?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing upnp.stop() through stop-advert.js and the socket.send call, then compare the emitted transport:outgoing-message with the packet observed in Wireshark. Also inspect create-location.js and the shutdownServers path for the unhandled rejection. Done means the byebye packet is sent successfully and stopping with a configured location does not reject unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, node.js, typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100