Upgrading from the WebSocket API Extension to the JavaScript API Library

The WebSocket API Extension is discontinued. If you need assistance, please contact Technical Support.

The JavaScript API Library is meant to replace the WebSocket API Extension feature. If you are upgrading from the WebSocket API Extension feature, review the differences described on this page.

Differences between the JavaScript API Library and the WebSocket API Extension

  1.  Files Unused:
    1. Cookie.js and devicewiseUtil.js are no longer used.
  2. Functions Removed:
    1. devicewise.connect(URL, callbackSuccess, callbackDisconnect, callbackError);
    2. devicewise.login2(username, password, callbackSuccess, callbackError);
    3. devicewise.loginToken(callbackSuccess, callbackError);
  3. Functions Altered:
    1. devicewise.login(username, password, callbackSuccess, callbackError); is replaced by devicewise.login(endpoint, username, password, callbackSuccess, callbackError);
    2. devicewise.channelSubscribe(channel, callbackSuccess, callbackError, callbackPost); The callbackPost function now returns a JSON object of the channel information instead of an array of the channel data.
    3. devicewise.subscribe(device, variable, rate, type, count, length, callbackSuccess, callbackError, callbackPublishReceived); The callbackPublishReceived now returns the value as opposed to a key/value pair.
    4. devicewise.SQLiteExec(query, callbackSuccess, callbackError); Now returns a JSON object of the queried data instead of a raw data array, or number.
    5. devicewise.deviceDataTypeEnum(callbackSuccess, callbackError); Now returns an array of the device types instead of XML.
    6. devicewise.deviceInfo(device, callbackSuccess, callbackError); Now returns a JSON object of the device information instead of XML.
    7. devicewise.referenceList(sourceType, source, options, callbackSuccess, callbackError); Now returns a JSON object of the reference list instead of XML.
    8. devicewise.deviceList(callbackSuccess, callbackError); Still returns an array of the devices, but the device objects now contain more information.
    9. devicewise.projectList(callbackSuccess, callbackError); Still returns an array of the projects, but the project objects now contain more information.
    10. devicewise.triggerList(projectName, callbackSuccess, callbackError); Still returns an array of the triggers, but the trigger objects now contain more information.
  4. Functions Added:
    1. devicewise.subtriggerFire(projectName, triggerName, reportingEnabled, variables, callbackSuccess, callbackError);
  5. Function arguments for numeric values are taken as string.
  6. All callbackError(errorCode, errorMessage); calls Now return both an error code and error message.

Upgrading to the base JavaScript API Library with the WebSocket API Extension Installed

The WebSocket API Extension feature, if being used, was added to a gateway using the Packages tab of the Workbench -> Administration window.

Starting with the 18.1.3 release, a full installation or a product update (using a .dwu file), will overwrite the /www/devicewise/ files installed by the WebSocket API Extension (dwwsapi.*.pkg) with the new JavaScript API Library files.

  • If the WebSocket API Extension JavaScript files are in a new location, other than the default install location of /www/devicewise, or the WebSocket API Extension JavaScript files have been renamed, then those files will not be overwritten.

Installing the WebSocket API Extension with the JavaScript API installed

Use of the WebSocket API Extension

If you need to use the WebSocket API Extension interface, meaning you have not changed your web applications to use the new JavaScript API Library feature, you can install the WebSocket API Extension (dwwsapi.*.pkg).

It is recommended that you update your web application to use the JavaScript API Library when updating to release 18.2.1 or later.

Starting with the 18.2.1 release, a full installation or a product update (using a .dwu file), will write the new JavaScript API Library files in /www/devicewise/.

If you need to use the WebSocket API Extension interface, meaning you have not changed your web applications to use the new JavaScript API Library feature, you can install the WebSocket API Extension (dwwsapi.*.pkg).

  • When you add the WebSocket API Extension (dwwsapi.*.pkg), it will overwrite the new JavaScript API Library files in /www/devicewise/.
  • If you then do another full installation or product update, it will overwrite the /www/devicewise/ files installed by the WebSocket API Extension (dwwsapi.*.pkg) with the new JavaScript API Library files.