in reply to Persistent HTTP connection

If the served UI behaves from a browser WWW::Mechanize::Firefox may be a good alternative to what you're doing.