IPWorks IoT 2020 Node.js Edition

Questions / Feedback?

ResponseOptionNumber Property

The option's number.

Syntax

 coap.getResponseOptionNumber(index, [callback])
 coap.setResponseOptionNumber(index,  responseOptionNumber, [callback])

Default Value

0

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getResponseOptionNumber([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setResponseOptionNumber([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

The option's number.

The property reflects the option's number, which must be a value in the range 0 to 65535 (inclusive). Setting this property to a recognized option number (see table below) will automatically set the ResponseOptionValueType property to the correct value (it should be set manually otherwise).

The following table provides a (non-exhaustive) list of some of the more common option numbers; refer to the IANA's CoAP Option Numbers registry for a full list.

Number Option
1 If-Match
3 Uri-Host
4 ETag
5 If-None-Match
6 Observe
7 Uri-Port
8 Location-Path
11 Uri-Path
12 Content-Format
14 Max-Age
15 Uri-Query
17 Accept
20 Location-Query
23 Block2
27 Block1
35 Proxy-Uri
39 Proxy-Scheme
60 Size1

The index parameter specifies the index of the item in the array. The size of the array is controlled by the ResponseOptionCount property.

This property is not available at design time.

Data Type

Integer

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Node.js Edition - Version 20.0 [Build 8265]