plgd-dev / go-coap

Implementation of CoAP Server & Client in Go
https://coap.technology
Apache License 2.0
443 stars 116 forks source link

Server response with ACK to Empty CON (CoAP Ping) #486

Open niondir opened 10 months ago

niondir commented 10 months ago

Due to rfc7252:

the four message types can be used as in Table 1. "*" means that the combination is not used in normal operation but only to elicit a Reset message ("CoAP ping").

In clientconn.go I can observe that also an ACK is accepted as Ping response: https://github.com/plgd-dev/go-coap/blob/ea0ff53e834887b79cc696bb06914a636bd1b6e4/udp/client/conn.go#L474

We did observe, that the server indeed sends back an ACK and not a Reset message when sending a CoAP Ping.

jeffwelder-ellenbytech commented 10 months ago

@niondir I'm actually using this "bug" to keep my observe connection alive with clients.

Client sends empty CON, server responds with ACK every couple minutes.

Is there a better way if this is intended to send a reset?