u9n / mqtt-sn-gateway

An asyncio Python implementation of a MQTT-SN Gateway
MIT License
3 stars 2 forks source link

DISCONNECT on invalid state #1

Closed Krolken closed 3 years ago

Krolken commented 3 years ago

When using the in-memory stores all state is lost on a restart. Devices that have done a CONNECT and REGISTER will now try to PUBLISH, but the gateway does not know of them.

If the gateway can't find the client in the store on a PUBLISH it is not sending a PUBACK with return_code=NOT_SUPPORTED.

This is not the best choice. For some devices the devices keeps on trying to publish until it finally sends an new CONNECT.

It would be better to send a DISCONNECT in the client cant be found to indicate to the client it needs a new CONNECT.