placed client.connect at the end of the example