Comparing version 0.4.2 to 0.4.3
@@ -150,3 +150,3 @@ const dgram = require('dgram') | ||
sender.send(buf, packet.code === '0.00') | ||
sender.send(buf, packet.ack || packet.reset) | ||
}) | ||
@@ -153,0 +153,0 @@ |
{ | ||
"name": "coap", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "A CoAP library for node modelled after 'http'", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -574,3 +574,3 @@ | ||
it('should error if it does not receive an ack four times before ~247s', function(done) { | ||
it('should not resend with a piggyback response', function(done) { | ||
var messages = 0 | ||
@@ -581,3 +581,27 @@ | ||
res.end('42') | ||
}) | ||
client.on('message', function(msg) { | ||
messages++ | ||
}) | ||
setTimeout(function() { | ||
expect(messages).to.eql(1) | ||
done() | ||
}, 45 * 1000) | ||
fastForward(100, 45 * 1000) | ||
}) | ||
it('should error if it does not receive an ack four times before ~247s', function(done) { | ||
var messages = 0 | ||
send(generate(packet)) | ||
server.on('request', function(req, res) { | ||
// needed to avoid sending a piggyback response | ||
setTimeout(function() { | ||
res.end('42') | ||
}, 200) | ||
res.on('error', function() { | ||
@@ -698,3 +722,9 @@ done() | ||
server.on('request', function(req, res) { | ||
// the first is the current status | ||
// it's in piggyback on the ack | ||
res.write('hello') | ||
// the second status is on the observe | ||
res.write('hello2') | ||
res.on('finish', function() { | ||
@@ -701,0 +731,0 @@ done() |
92835
2464