Enter sleep state for the specified duration.
async mqttsn.startSleep(duration : number): Promise<void>
While in the sleep state, the client no longer must abide by the KeepAliveInterval, but must awake before the end of the sleep duration. If it does not send the gateway any messages in this interval, it will be considered lost and will disconnect.
mqttsn1.StartSleep(8); // sleep for 8 seconds // ... wait for 5 seconds mqttsn1.FetchMessages(); // MessageIn will fire for each message buffered during that time // ... wait for 5 more seconds (ok because <8 seconds since last packet sent) mqttsn1.StopSleep();