M
M
mr null2018-02-03 07:11:01
PHP
mr null, 2018-02-03 07:11:01

RatchetPHP WebSocket how to connect such a host?

There is a class for working with web sockets, https://github.com/ratchetphp/Pawl
But it does not accept connections to "wss://streamer.1111.com/socket.io/?EIO=3&transport=websocket" hosts of this kind , that's normal for such "wss://streamer.1111.com". I can’t understand, maybe it’s possible to somehow change this without getting into the jungle of edits, for example, at the expense of headers.

<?php
require __DIR__ . '/vendor/autoload.php';
 

\Ratchet\Client\connect('wss://streamer.1111.com/socket.io/?EIO=3&transport=websocket', array(), array())->then(function($conn) {
    $conn->on('message', function($msg) use ($conn) {
        echo "Received: {$msg}\n"; 
    });

}, function ($e) { 
    echo "Could not connect: {$e->getMessage()}\n";
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mr null, 2018-02-03
@mr_null

The question is closed, everything works, just the output looped, did not attach any value to this - timeout.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question