Client reconnect

I think this can be merged now.

Fixes #44.

/cc @jcrugzz @indexzero