intel / iotivity-node

Node.js bindings for IoTivity
https://www.iotivity.org/
42 stars 44 forks source link

why removed object in payload.values? #159

Closed karavolt closed 6 years ago

karavolt commented 6 years ago

hi,

i'm trying to send response for get method. but client can't get data property in payload.values.

ex) server send response like this: payload = { type: iotivity.OCPayloadType.PAYLOAD_TYPE_REPRESENTATION, values: { serial: 'uuid', data: { text: 'hello', id: 1 } } } then client get response payload: { type:4, values: { serial: 'uuid', data: null } } is this spec problem? or node version problem? client using 7.10.1 version, server using 6.11.4 version.

gabrielschulhof commented 6 years ago

The payload needs to look like this:

{
  type: iotivity.OCPayloadType.PAYLOAD_TYPE_REPRESENTATION,
  values: {
    serial: 'uuid',
    data: {
      type: iotivity.OCPayloadType.PAYLOAD_TYPE_REPRESENTATION,
      values: {
        text: 'hello',
        id: 1
      }
    }
  }
}
gabrielschulhof commented 6 years ago

This iotivity-node test gives you an example of a payload that has object-valued properties.