PHP code example of own3d / socket

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

    

own3d / socket example snippets


'own3d-socket' => [
    'username' => env('OWN3D_SOCKET_USERNAME', 'own3d-socket'),
    'password' => env('OWN3D_SOCKET_PASSWORD')
    'secret' => env('OWN3D_SOCKET_SECRET'),
],

'own3d-socket' => [
    'driver' => 'own3d-socket',
    'room_prefix' => env('OWN3D_ID_KEY'),
],

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ExampleEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    private string $userId;
    
    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('channel-name');
    }
}