On the client-side, I want to observe a resource with a large message and I'm getting a bad request as a status code.
I would like to intensify that for small and medium messages(size until 1K), it works well.
What do I need to do to get the payload for the large message? Am I doing something wrong?
const coap = require("coap");
const setup = {
host: 'CLOUD_IP',
observe: true,
port: 5683,
pathname: '/middlewareToCloud',
method: 'GET'
}
const req = coap.request(setup)
// edit this to adjust max packet
req.setOption('Block2', Buffer.of(0x2))
req.on('response', (res) =>
{
res.on('data', (data) => {
console.log(Buffer.from(data).toString('utf8'));
})
});
req.end()