PHP code example of roysegall / php_socket-io_client

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

    

roysegall / php_socket-io_client example snippets


$socketio = new SocketIO();
if ($socketio->send('localhost', 9090, 'message', 'Hello world!')){
    echo 'we sent the message and disconnected';
} else {
    echo 'Sorry, we have a mistake :\'(';
}

$socketio = new SocketIO();
if ($socketio->send('localhost', 9090, 'message', 'Привет мир!')){
    echo 'Мы отправили сообщение и отключились от сокета';
} else {
    echo 'Возникла ошибка при общении с  веб-сокетом :\'(';
}