lwm2m-node-lib
lwm2m-node-lib copied to clipboard
updateConnection operation should use POST(CoAP) method
In file lwm2m-client.js
function updateRegistration(deviceInformation, callback) { var rs = new Readable(), creationRequest = { host: deviceInformation.currentHost, port: deviceInformation.currentPort, method: 'PUT', pathname: deviceInformation.location, query: 'lt=' + config.client.lifetime + '&lwm2m=' + config.client.version + '&b=U' },
The method "PUT" should be "POST". There is no log while updateConnection use PUT. But the console outputs the right log while use POST
The lwm2m-server.js recieve POST method, so as the LWM2M Document.
serverInfo.routes = [
['POST', /^\/rd$/, 'registration'],
['DELETE', /\/rd\/.*/, 'unregistration'],
['POST', /\/rd\/.*/, 'updateRegistration']
];