Tidy lib/connection
Specify keepalive in seconds rather than ms

Closes #36