I want to connect to Meetup RSVP API, using ReactPHP, but fail. This is how I do it:
require __DIR__ . '/vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$connector = new React\Socket\Connector($loop);
$connector->connect('ws://stream.meetup.com/2/rsvps')->then(function (React\Socket\ConnectionInterface $connection) {
echo 'Connected!';
});
I do not get any error messages, but I do not see Connected!
message. I also tried Pawl library this way:
$loop = React\EventLoop\Factory::create();
$connector = new Ratchet\Client\Connector($loop);
$connector('ws://stream.meetup.com/2/rsvps')
->then(function (Ratchet\Client\WebSocket $conn) use ($http) {
$conn->on('message', function($msg) use ($conn) {
echo "Received: {$msg}
";
$conn->close();
});
}, function (\Exception $e) use ($loop) {
echo "Could not connect: {$e->getMessage()}
";
$loop->stop();
});
But to no avail. I see no message from on message handler, and I see no message from exception handler. So, what is wrong with that and how can I fix it?