Home

The Vortex DDS API for NodeJS.

Require the 'vortexdds' module

Import the vortex dds module into your server-side JavaScript files:

const dds = require('vortexdds');

Asynchronous aspects of the API

Some DDS operations can take a long time. In order to not block the execution of other asynchronous JavaScript operation, the Vortex DDS API for NodeJS uses asynchronous operations the return standard JavaScript Promise objects.

In addition, at creation, some entities accept a 'listener' object, which defines one or more 'callback' methods, which are called asynchronously by the NodeJS engine when the appropriate event occurs. Entities supporting listeners are: Topic, Reader and Writer. See their factory methods for documentation on these listeners.

Releasing DDS resources

Many DDS objects have associated with them resources obtained from the DDS system. The NodeJS engine does not reclaim these resources, even if it garbage collects an object the represents such a resource.

In order to avoid leaking of DDS resources, you should take care to call the appropriate delete() method when you are finished with a DDS object. Once the delete() method is called on an object, it is no longer usable.

Many DDS objects are organized into a hierarchy. DDS objects created by factory methods on another DDS object are implicitly 'owned' by that 'parent' object. If a parent object is deleted, then all directly and indirectly owned objects are also deleted. The only DDS types that are not 'owned' by other objects are:

To completely clean-up DDS resources, at a minimum, your program must explicitly delete all instances of the above types. Instances of other DDS objects may be explicitly deleted by your program once you no longer require them. Explicitly deleted such objects will reduce the footprint of your DDS application.

Exceptions

Most APIs will throw exceptions, rather than return 'error codes'.

The most common exception thrown is DDSError, which represents an error within the DDS system. Frequently, additional information is written to the file dds-error.log. All methods that throw DDSError have this fact explicitly documented.

Most methods also type-check their arguments. If errors are found in these arguments, then a standard JavaScript TypeError is typically throw. The documentation does not explicitly document when TypeError is thrown.

Key API references