Buffers via DDS on node.js

5 posts / 0 new
Last post
Offline
Last seen: 4 years 2 weeks ago
Joined: 04/22/2019
Posts: 6
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: 2 months 3 weeks ago
Joined: 04/02/2013
Posts: 196

Hi Hadar,

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

Alex

Offline
Last seen: 4 years 2 weeks ago
Joined: 04/22/2019
Posts: 6

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: 2 months 3 weeks ago
Joined: 04/02/2013
Posts: 196

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: 4 years 2 weeks ago
Joined: 04/22/2019
Posts: 6

Thank you, setNumber for each element worked.

Hadar