Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.
This repository was 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

@truedat101

Description

@truedat101

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions