Skip to content

docs: add comment to simple-publish.js (binary msg)#2031

Open
mjcross wants to merge 2 commits intomqttjs:mainfrom
mjcross:binary-publish-example
Open

docs: add comment to simple-publish.js (binary msg)#2031
mjcross wants to merge 2 commits intomqttjs:mainfrom
mjcross:binary-publish-example

Conversation

@mjcross
Copy link
Copy Markdown

@mjcross mjcross commented Nov 7, 2025

Just to add a short comment to the example, as a hint for users wanting to publish a binary message from the browser.
It can be confusing to know how to do that, when you don't have node.js Buffer available.

For a new user it can be confusing how to publish a binary message from the browser.
@mjcross mjcross changed the title Add comment to simple-publish.js (binary msg) docs: add comment to simple-publish.js (binary msg) Nov 7, 2025
Copy link
Copy Markdown
Member

@robertsLando robertsLando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment should be placed on readme instead

@mjcross
Copy link
Copy Markdown
Author

mjcross commented Nov 8, 2025

Sounds good to me, @robertsLando - I'll have a look at that

Illustrates how to publish a binary message (from a browser)
@mjcross
Copy link
Copy Markdown
Author

mjcross commented Nov 8, 2025

@robertsLando hope this looks OK 91f6e46

Comment thread README.md

- `topic` is the topic to publish to, `String`
- `message` is the message to publish, `Buffer` or `String`
- `message` is the message to publish, `Buffer` (in browser `Uint8Array`) or `String`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is enough, no need to also add an example

Copy link
Copy Markdown
Author

@mjcross mjcross Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - although as a user, I can say examples are incredibly valuable (and it also illustrates how to make a WSS connection, which gives a 'self contained' example for how to connect from a browser)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants