Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IClientPublishOptions.payloadFormatIndicator type definition specifies it must be a number, but it only works with a boolean value. #1334

Closed
mg90707 opened this issue Oct 4, 2021 · 2 comments
Labels

Comments

@mg90707
Copy link

mg90707 commented Oct 4, 2021

Hello,
according to the typescript definitions in client-options.d.ts IClientPublishOptions.payloadFormatIndicator must be a number. However when passing a number (0 or 1) publishing fails, because in the "mqtt-packet" package the payloadFormatIndicator is checked for a boolean value (false or true) and not a numeric value.

This is the check that fails for a numeric value:
https://github.com/mqttjs/mqtt-packet/blob/23774e79e0ca83a718b95d254414964e7a421b1f/writeToStream.js#L902

According to the docs here https://github.com/mqttjs/MQTT.js payloadFormatIndicator should be a boolean. Therefore I guess the typescript defitions should get changed accordingly.

I'm using MQTT.js v4.2.8.

@YoDaMa
Copy link
Contributor

YoDaMa commented Oct 4, 2021

@mg90707 thanks for identifying it. please make a PR for the change so we can merge it in and get this updated on the next release :)

Copy link

github-actions bot commented May 1, 2024

This is an automated message to let you know that this issue has
gone 365 days without any activity. In order to ensure that we work
on issues that still matter, this issue will be closed in 14 days.

If this issue is still important, you can simply comment with a
"bump" to keep it open.

Thank you for your contribution.

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

No branches or pull requests

3 participants