connection it not always set initially but is after connection.

It's not clear when one should use @client.connection or @client.socket since it seems to depend on the timing of the connection. I had a "not such property setTimeout" in one setup.

This new method seems to work on my two environments.