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

Please add publish(topic,payload,retained) function. #917

Open
wants to merge 207 commits into
base: master
Choose a base branch
from

Conversation

vrdust
Copy link

@vrdust vrdust commented Dec 28, 2021

Imroy added 30 commits April 23, 2015 10:20
Use WiFiClient instead of Client.
Use IPAddress instead of a byte array.
…parameters

Why pass in "client"? Just make it a class variable.
willRetain is a boolean and willQos can only be 0, 1, or 2.
…ubSubClient

This feels a little like I've reimplmented PubSubClient.
I wanted to support more options for the various messages and that meant creating a separate class just for message data.
Then to handle the different options for the different messages, I had to create a class for each message type.

Streaming functionality is currently not implemented. It is commented out for now.
At one point I had private variables for things that are stored in '_flags'.
As a side effect, it increments the value. Hopefully that's obvious from the name.
Storing Strings in an array appears to be a bad idea.
Assume that next_packet_id() did that already.
Improve logic of next_packet_id() to avoid id 0.
… the "end"

The reserve() method doesn't change the "length" of the string. So all is left is the += operator (or concat() method).
Prints the topic and payload of every message it receives.
…instead of the MQTT_KEEPALIVE define

MQTT_KEEPALIVE is the default value.
…rning false, instead of having a big 'if' block around almost everything
Imroy and others added 30 commits May 17, 2017 20:15
…brary has no such define

And sizes are 32-bit now.
TODO: Will have to construct the 'publish' packets with the correct size when this max size is greater than 127 bytes.
A better way to encapsulate the state variables.
Still untested!
…g length byte(s)

This allows us to parse the small, simple packets e.g connack, ping, etc. They're only four bytes, smaller than the five byte minimum in _read_header().
_read_length() is reenterable, able to shift a single available byte and continue later.
…e message

It returns nullptr instead of false.
…s for a response

The second one returns a message pointer of the message that came back, thanks to _wait_for().
CONNACK doesn't necessarily mean the connection was successful.
Home Assistant did not like having a null byte after the JSON.
added setTimeGetter function to support time handling when millis() a…
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.

10 participants