Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question