PHP code example of iliakologrivov / centrifuge

1. Go to this page and download the library: Download iliakologrivov/centrifuge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iliakologrivov / centrifuge example snippets


IliaKologrivov\Centrifuge\CentrifugeRouterFacade::subscribe();
IliaKologrivov\Centrifuge\CentrifugeRouterFacade::refresh();

'connections' => [
    'centrifuge' => [
        'driver' => 'centrifuge',
    ],
    // ...
],



namespace App\Events;

use Illuminate\Broadcasting\InteractsWithSockets;
use IliaKologrivov\Centrifuge\Channels\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class event implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public function broadcastAs()
    {
        return 'event-name';
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Centrifuge\Channels\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('example-channel');
    }
}