You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I see following behavior on CoAP server: after any notification write to response stream on observe request Error: Empty messages must be empty exception appears.
const coap = require('coap')
, server = coap.createServer()
server.on('request', function(req, res) {
if (req.headers['Observe'] !== 0)
return res.end(new Date().toISOString() + '\n')
var interval = setInterval(function() {
res.write(new Date().toISOString() + '\n')
res.reset(); // <-------------- here it fails
}, 1000)
res.on('finish', function(err) {
clearInterval(interval)
})
})
server.listen(function() {
console.log('server started')
})
I follow up with stack trace and can say that this happens because of not empty res._packet.options after first res.write (so if I do reset before first write there is no error).
P.S. When I do res._packet.options = [] manually before reset it seems to be ok (no exception), but how can I track that connection has been dropped? No 'end' events on client side for ObserveReadStream instance is triggered.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions.
This issue has been automatically closed because of inactivity. Please open a new issue if still relevant and make sure to include all relevant details, logs and reproduction steps. Thank you for your contributions.
Hello. I see following behavior on CoAP server: after any notification write to response stream on observe request Error: Empty messages must be empty exception appears.
I follow up with stack trace and can say that this happens because of not empty
res._packet.options
after firstres.write
(so if I do reset before first write there is no error).Related: #154
@mcollina @GiedriusM Could you please advice?
P.S. When I do
res._packet.options = []
manually before reset it seems to be ok (no exception), but how can I track that connection has been dropped? No 'end' events on client side for ObserveReadStream instance is triggered.The text was updated successfully, but these errors were encountered: