Need clarification on correct pubsubclient (MQTT) usage

Hello,
I've been using the knolleary pubsubclient (MQTT client) for a while. I use it for home automation with OpenHAB. But I've always had a bug where the client disconnects (somehow) from my Mosquitto MQTT broker for seemingly no reason, and doesn't reconnect. I've had to write code around it to make it check periodically and reconnect, but it doesn't seem like I should have to do that. I have a feeling I'm not using the pubsubclient correctly.

Does anyone have a fairly bullet proof example of using pubsubclient with Arduino? Even the sample code that comes with the library seems to do the same disconnect thing.

Here's the code for my MQTT client.

I'm using it as part of my home automation system like this:
http://www.instructables.com/id/Uber-Home-Automation/

I'd appreciate any advice. Thank you.