Adds auto reconnct and ping (fixes #3)