PHP code example of friendsofhyperf / websocket-cluster-addon

1. Go to this page and download the library: Download friendsofhyperf/websocket-cluster-addon 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/ */

    

friendsofhyperf / websocket-cluster-addon example snippets


use FriendsOfHyperf\WebsocketClusterAddon\Emitter;
$emitter = $container->get(Emitter::class);
$emitter->emit($contactId, $message);

use FriendsOfHyperf\WebsocketClusterAddon\Emitter;
$emitter = $container->get(Emitter::class);
$emitter->broadcast($message);
bash
php bin/hyperf.php vendor:publish friendsofhyperf/websocket-cluster-addon