Closed LubinLew closed 4 months ago
Hi @LubinLew
Thanks for your interest in the wolfMQTT project.
What the effect of MqttNet.read and MqttNet.write ?
Those are the IO interface function pointers in the network layer abstraction object. This provides flexibility for the library to use any medium for transmitting IO. They will not be used directly by the application for MQTT messaging.
If you are running the client in Ubuntu, try the example/mqttclient demo https://github.com/wolfSSL/wolfMQTT/tree/master/examples/mqttclient
./examples/mqttclient/mqttclient -h <broker address>
Can you tell us a bit about your project using wolfMQTT? Feel free to email support@wolfssl.com for a more private format.
Thanks, Eric - wolfSSL Support
@embhorn
Thanks for your answer. I know how this library works. It is a low-level library. But what I want is a high-level API, Hiding the details of the potocol. I don't want to create socket myself and read/write to the socket directly. The examples are great but too many macro conditions. I think the examples should be packaging to a high-level API works as below.
int subscribe_callback(msg)
{ // read msg
}
int main()
{
mqtt_init(version=V5, io_mode=BLOCK, ...)
mqtt_connect(host, port, ...)
mqtt_subscribe(topic_list, subscribe_callback, ...)
mqtt_loop_run(...);
}
Hi @LubinLew
That's the typical tradeoff - functionality VS complexity. The wolfMQTT API is not significantly more complex than what you shared: Here is a simple client subscribe: https://github.com/wolfSSL/wolfMQTT/blob/master/examples/pub-sub/mqtt-sub.c
We are happy to help answer any questions you might have.
Thanks for the help.
Hi team, I'm new to MQTT and I have a few questions about wolfMQTT.
infos
questions
What the effect of
MqttNet.read
andMqttNet.write
? I want to build a client which only do subscribe. I don't know what's to do in the callback.The program below
MqttClient_NetConnect()
andMqttClient_Subscribe()
return 0, but I can‘t capture any packet(even SYN) on server side.