Thanks @henksb I will try your ideas. Can we talk a bit more about using the STM32CubeIDE? Perhaps on a different thread. My problem with the Portenta and all the MBED boards is that for anything advanced you have to look at the ARM MBED API but as far as I know we can't run the Portenta using the Keil Studio which all the demonstration code from Arm runs on. It is a bit of a catch22 where Arduino doesn't really mention it and Arm doesn't support it.
Presently have a heck of a time getting WiFiSSLClient websockets running.