Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

using 1.3.0 on windows + mosquitto, basic example with JSON encoder sends squashed json string #6

Open
truedat101 opened this issue Mar 13, 2019 · 0 comments

Comments

@truedat101
Copy link

If I run the basic example provided:

const toad = require('mqttletoad');
 
(async function () {
  const client = await toad.connect('wss://test.mosquitto.org', {
    encoder: 'json',
    decoder: 'json'
  });
  
  await client.subscribe('foo/bar', message => {
    console.log(message.baz); // quux
  });
  
  // see listener above
  await client.publish('foo/bar', {baz: 'quux'});  
}());

The output is "undefined", meaning message.baz was not defined. If I inspect further, message = "[Object object]". It appears the default set to JSON encoding/decoding is ignored, or forced to be text.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant