Buffers via DDS on node.js

5 posts / 0 new
Last post
Offline
Last seen: 1 year 5 months ago
Joined: 04/22/2019
Posts: 4
Buffers via DDS on node.js

Hello,

I'm considering to use the abilties of DDS node.js package.

I saw the shapes example and it works just fine, but I couldn't find an array or buffers data passing between subscriber and publisher.

Is it possible to transfer a blob data between subscriber and publisher on node.js?

Thanks in advance

Hadar

Offline
Last seen: 4 days 16 hours ago
Joined: 04/02/2013
Posts: 145

Hi Hadar,

Did you consider a type definition with a sequence of octets?

Alex

Offline
Last seen: 1 year 5 months ago
Joined: 04/22/2019
Posts: 4

Hi,

Yes, I used an octet in my xml, but I don’t know how to send it in node.js when I use the rti npm package.

Thanks

Offline
Last seen: 4 days 16 hours ago
Joined: 04/02/2013
Posts: 145

There are two options (described here)

1) output.instance.setNumber("myArray[i]",x);

That sets the element i of a field called myArray to the value x.

2) Use output.setFromJson(value)

Where value is a json representation of a data sample, e.g. {"x":3, "myArray":[1, 2, 3, 4]} 

 

Offline
Last seen: 1 year 5 months ago
Joined: 04/22/2019
Posts: 4

Thank you, setNumber for each element worked.

Hadar