Skip to content

[enterprise] Backwards compatibility issue incoming data #8

@troykelly

Description

@troykelly

On the production client, it has been necessary to convert incoming data to JSON for handling inside the .write function. eg

Device.prototype.write = function (data) {
var self = this;
data = JSON.parse(data);
// I'm being actuated with data!

However, this generates an error on the new enterprise client, given that "data" is already an object.

My work around to make the driver valid on both platforms is:

Device.prototype.write = function (data) {
var self = this;
if (Object.prototype.toString.call(data) != "[object Object]") { data = JSON.parse(data); }
// I'm being actuated with data!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions