PHP code example of raheelrafiq326 / websocket

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

    

raheelrafiq326 / websocket example snippets


protected function schedule(Schedule $schedule): void
{
    // call this command to be schedule
    $schedule->command('websocket:serve')->withoutOverlapping();
}

use RaheelRafiq326\Websocket\WebSocketClient;

// Change value with your channel name.
$channel = "<Channel Name>";

// Change value with your event name.
$event = "<Event Name>";

// Chnage value according to your 
terminal
php artisan vendor:publish --tag=websocket
terminal
php artisan websocket:serve
terminal
php artisan schedule:run
terminal
php artisan vendor:publish --tag=websocket-js