Is there a project to improve/replace the official examples?

First find the part that is blocking execution.

My guess is it's client.connect(server, 80). Perhaps that library has alternatives to waiting.