update to automatically handle reconnects and keepalive pings