ecorvo
ecorvo

Reputation: 3629

Subscribe to a PubNub Channel using PHP

If I subscribe to a PubNub Channel using PHP will it stay subscribe for ever until the server is restarted or will eventually timeout and unsubscribe on its own?

Example code bellow:

$pubnub->subscribe(array(
    'channel' => 'xxxxxxxxxxxxxxxxxxx',
    'callback' => function ($message) {
            //do stuff
            return true;
        }
));

Upvotes: 2

Views: 353

Answers (1)

Geremy
Geremy

Reputation: 2445

Having the callback return false will break the loop / return control. More info here:

https://github.com/pubnub/php#receive-message-subscribe

Upvotes: 1

Related Questions