dimanche 30 juin 2019

WebSocket connection to 'ws://127.0.0.1:8888/' failed: WebSocket opening handshake timed out

im developing a websocket with ratchet, and when i try to connect to it, after a few minutes it only prints "WebSocket connection to 'ws://127.0.0.1:8888/' failed: WebSocket opening handshake timed out" in console, but in the shell prints:

New connection! (48)
Connection 48 sending message "GET / HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
Accept: */*
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Sec-WebSocket-Version: 13
Origin: http://socketo.me
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: kMUmcl5+slye1dy0ISFOtQ==
DNT: 1
Connection: keep-alive, Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket

" to 0 other connections

server code:

    <?php

use Ratchet\Server\IoServer;
use MyApp\Chat;
    require dirname(__DIR__) . '/vendor/autoload.php';

    $server = IoServer::factory(
        new Chat(),
        8888
    );

    $server->run();
?>

client code:

<!DOCTYPE html>
    <script>
    const conn = new WebSocket('wss://127.0.0.1:8888');
conn.onopen = function(e) {
    console.log("Connection established!");
};

conn.onmessage = function(e) {
    console.log(e.data);
};

    </script>

i have tried with another browser, changing the port and doesnt work yet




Aucun commentaire:

Enregistrer un commentaire