Add connect method which handles the cookie data.