Modified the pubnub example to fix the hang issues