We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I see there's no option for sending a disconnect packet to broker. This can be useful for sharing same broker connections among clients.
My 2 cents:
In ESP8266MQTTClient.cpp add:
bool MQTTClient::disconnect(void) { sendDisconnect(); free(_state.in_buffer); free(_state.out_buffer); LOG("[MQTT_client] disconnect!\n"); return true; }
void MQTTClient::sendDisconnect() { _state.outbound_message = mqtt_msg_disconnect(&_state.connection); _state.pending_msg_type = mqtt_get_type(_state.outbound_message->data); _state.pending_msg_id = mqtt_get_id(_state.outbound_message->data, _state.outbound_message->length); LOG("Sending MQTT_MSG_TYPE_DISCONNECT\r\n"); _transportTraits->write(_tcp.get(), _state.outbound_message->data, _state.outbound_message->length); }
And their corresponding function declarations in header file:
bool disconnect(); void sendDisconnect();
Rgds,
Richard
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I see there's no option for sending a disconnect packet to broker. This can be useful for sharing same broker connections among clients.
My 2 cents:
In ESP8266MQTTClient.cpp add:
bool MQTTClient::disconnect(void)
{
sendDisconnect();
free(_state.in_buffer);
free(_state.out_buffer);
LOG("[MQTT_client] disconnect!\n");
return true;
}
void MQTTClient::sendDisconnect()
{
_state.outbound_message = mqtt_msg_disconnect(&_state.connection);
_state.pending_msg_type = mqtt_get_type(_state.outbound_message->data);
_state.pending_msg_id = mqtt_get_id(_state.outbound_message->data,
_state.outbound_message->length);
LOG("Sending MQTT_MSG_TYPE_DISCONNECT\r\n");
_transportTraits->write(_tcp.get(), _state.outbound_message->data,
_state.outbound_message->length);
}
And their corresponding function declarations in header file:
bool disconnect();
void sendDisconnect();
Rgds,
Richard
The text was updated successfully, but these errors were encountered: