added timeout for pubsub

I have a firewall issue where an open socket gets severed after a period of time. I needed to implement a timeout for the pubsub, and (separately) implement an ack mechanism. I didn't want to alter the existing method with an infinite timeout.