Xbee S6b WiFi sleep procedure

Does anybody have a Digi WiFi S6B sleep procedure that works for them when using AT cmds to manage a TCP/IP to connect to a remote.

I’m using a S6B with a pin sleep procedure and a remote TCP/IP with TinyGSM lib.
It has worked well from power up, connecting a TCP/IP to a remote web site, doing a POST and waiting for a response over the UART.
On the first connection works very well. On subsequent connections can be be very unreliable.

On characterizing it, if it is only sleeping for a minute or two seems like it can connect on wake. However if the sleep is a couple of minutes (5) or more - then it has a lot of trouble making he connection.
It seems like its related to the external network maintaining the TCP/IP connection while the S6B sleeps. There hasn’t been a way of checking the status of the TCP/IP link after waking and/or refreshing it.
In a recent test, running at 10min connection POST - it stopped after the first, but then a day later, possibly after my network router rebooted, it started working again.
Part of the issue is working through the AT cmds from TinyGSM lib, as it has a rigid view of when the TCP/IP link is expected to be there,
There was an issue with the TinyGSM lib doing repetitive writes, but this has now been fixed to only do a read first, and only write if needs changing.

However the core issue is understanding how the S6B works. The manual is very sparse
https://www.digi.com/resources/documentation/Digidocs/90002180/
and examples simplistic
https://www.digi.com/products/embedded-systems/digi-xbee/rf-modules/2-4-ghz-rf-modules/xbee-wi-fi#resources

If any insights much appreciated.

I would suggest using API mode. Then you can crate the socket, close the socket and cycle to a sleep state.