Mqttnet: Cant find Control Packet to manage PINGREQ/PINGRESP

Created on 15 Jul 2020  路  7Comments  路  Source: chkr1011/MQTTnet

Describe your question

I'm using MQTTnet to build a Windows Service based Broker, which require to manage the KeepAlive pattern and more of that, to answer my clients with PINGRESP, when they send a PINGREQ. Is there any Implementation sample I could use ?
I had a look at the source code, found some things in MQTTnet.Packets (such as MqttPingReqPacket, MqttPingRespPacket...) but no way how to use them in practice...

Thanks for your help !

Which project is your question related to?

  • MQTTnet.Server standalone
question

All 7 comments

whats your usecase? the server handles pings on its own.

@JanEggers : Then my problem is somewhere else... My several clients do not receive the PINGRESP from my server and disconnect/reconnect on each PINGREQ. Is there any Mqtt Server Option that would probably have incidence on this process ?

Here's mine :

`
// Initialize options
MqttServerOptionsBuilder _optionsbuilder = new MqttServerOptionsBuilder()
.WithConnectionBacklog(100)
.WithoutDefaultEndpoint()
.WithEncryptedEndpoint()
.WithEncryptedEndpointPort(m_BrokerPort)
.WithEncryptionSslProtocol(System.Security.Authentication.SslProtocols.Tls12)
.WithEncryptionCertificate(_cert.Export(X509ContentType.SerializedCert), new MqttServerCertificateCredentials() {
Password = _certificatepassword })
.WithPersistentSessions();

`

do you have server side logging enabled? then you should see if the server receives the requests. (https://github.com/chkr1011/MQTTnet/wiki/Trace)

Trace Added,

Ping REQ and RESP appear when using MQTTnet also as client. I'm now investigating to understand why it is not the case when using an embedded library on Eclipse....

hmm next step would be wireshark to verify what is actually transmitted when using the embedded library,

Right !

...Using MOSQUITTO on an Rpi as broker, seems to also receive REQ/RESP correctly using the embedded mosquitto lib....

Perhaps I will finally face a misundertsanding of implementation between libs....

I'll let you know the result of my investigations.

Problem solved.

It deals with the publish frequency which is randomly superior to the ping interval !
In that case, no ping req is sent, and then no resp is feedback.

Thanks for your help

Was this page helpful?
0 / 5 - 0 ratings