How to create a CoAP block-wise transfer on NodeJS? I use node-coap module. I send a request to:
var options = {
host: 'coap.me',
port: 5683,
pathname: '/test',
method: 'PUT',
};
I also do this: req.setOption('Block2', new Buffer([1]));
This method should create a CoAP option and mean that size of payload is 32 bytes. After that I don't know what to do. I try for
cycle (body
= 32 bytes):
for(var i = 0; i < 100; i++){
if(i === 99){
req.end(body);
} else {
req.write(body);
}
}
Everything I have is an error: Max packet size is 1280: current is 265951
Or if I should use different requests, how to map one after another? Because every request produce a response and my program ends after first request.