PHP code example of alexkratky / php-socketio

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

    

alexkratky / php-socketio example snippets




use AlexKratky\PHPSocketIO;
$ip = "localhost";
$port = 8000;
$password = "password";
$secured = true; //https?
$channel = "room1";
$data = array(
    "ID" => 1,
    "name" => "Alex"
);

$socket = new PHPSocketIO($ip, $port, $password, $secured);
$socket->sendData($channel, $data);