Added ping callback for checking connection.
Updated and simplified sample code and documentation