Skip to content

2.0.0 Upgrade to centrifugo v 3

Compare
Choose a tag to compare
@denis660 denis660 released this 05 Dec 14:56
· 93 commits to master since this release

There are config file changes here that are not backward compatible!
You only need to change the name of the variables.

Otherwise, your code should work the same as it did in version 1.

The update was related to the transition to CENTRIFUGO v3, if you are using CENTRIFUGO v2, I recommend first reading the update information on v3 https://centrifugal.dev/docs/getting-started/migration_v3

  • Added optional parameters limit, since, reversehistory to the history method. Now, by default, the history is not returned, it is necessary to transfer a limit on how many last messages need to be received
  • Added optional skipHistor parameter for method publish and method broadcast
  • Added optional pattern parameter for method channels
  • Added optional client parameter to unsubscribe method
  • Added the optional channels parameter to the generateConnectionToken method
  • Added subscribe method

Changing the names of the config / broadcasting.php variables, here is the new code for your file

        'centrifugo' => [
            'driver' => 'centrifugo',
            'token_hmac_secret_key'  => env('CENTRIFUGO_TOKEN_HMAC_SECRET_KEY',''),
            'api_key'  => env('CENTRIFUGO_API_KEY',''),
            'url'     => env('CENTRIFUGO_URL', 'http://localhost:8000'),
            'verify'  => env('CENTRIFUGO_VERIFY', false),
            'ssl_key' => env('CENTRIFUGO_SSL_KEY', null),
        ],

in your .env replace

CENTRIFUGO_SECRET to CENTRIFUGO_TOKEN_HMAC_SECRET_KEY
CENTRIFUGO_APIKEY to CENTRIFUGO_API_KEY