Skip to content

Commit 91e7a73

Browse files
authored
Remove throw when payload is not an Object
According to the MQTT Standar, the payload is not always a json Object or json Array. It could be binary data.
1 parent c69b09d commit 91e7a73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/angular-MQTT.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ angular.module('ngMQTT', [])
2929
try {
3030
var data = JSON.parse(payload.toString());
3131
}catch (e){
32-
throw new Error("received data can not parse for JSON !");
32+
var data = payload.toString();
3333
}
3434
angular.forEach(callbacks,function(callback, name){
3535
var regexpStr = name.replace(new RegExp('(#)|(\\*)'),function(str){
@@ -57,4 +57,4 @@ angular.module('ngMQTT', [])
5757
client.publish(name, JSON.stringify(data));
5858
};
5959
return Service;
60-
}]);
60+
}]);

0 commit comments

Comments
 (0)