walkor / phpsocket.io

A server side alternative implementation of socket.io in PHP based on workerman.
2.3k stars 508 forks source link

Strange characters in the connection #259

Closed CamiloTilaguy closed 3 years ago

CamiloTilaguy commented 3 years ago

I have a problem with strange characters that can be seen in the Google Chrome console.

Any idea of the error?

My file is (in utf-8):


<?php
use Workerman\Worker;
use PHPSocketIO\SocketIO;

require_once __DIR__ . '/vendor/autoload.php';

// SSL context
$context = array(
    'ssl' => array(
        'local_cert'  => '.../fullchain.pem',
        'local_pk'    => '.../privkey.pem',
        'verify_peer' => false
    )
);
$io = new SocketIO(2021, $context);

$io->on('connection', function($connection)use($io){

    $io->emit('elMensajeServido', 'Se conecto un cliente, Conexiones: 12');
    $io->emit('panel_N_visitantes_online', 12);
    echo 'conecto: 12\n';
});

Worker::runAll();

Captura de Pantalla 2021-01-27 a la(s) 4 26 53 p  m

walkor commented 3 years ago

Don't worry, it's part of the socket.io's protocol, no problem.