I have a situation where I want to display dynamic data that is received from this API wss://stream.binance.com:9443/ws/btcusdt@depth
. I want to use ratchet
and I have written code like this
require __DIR__ . '\vendor\autoload.php';
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
\Ratchet\Client\connect('wss://stream.binance.com:9443/ws/btcusdt@depth')->then(function($conn) {
$conn->on('message', function($msg) use ($conn) {
echo "Received: {$msg}
";
// $conn->close();
});
// $conn->send('Hello World!');
}, function ($e) {
echo "Could not connect: {$e->getMessage()}
";
});
but here its giving me the following error:
Fatal error: Uncaught Error: Call to undefined function Ratchet\Client\connect()
I'm not sure where to look for the error.