I've been trying to get ReactPHP socket up and running for a bit now, once up, I can telnet to it on the specified port but I cannot use websocat or any js lib to connect via ws:// protocol. Any help would be appreciated.
$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server('127.0.0.1:8000', $loop);
$socket->on('connection', function(ConnectionInterface $connection) use ($colors) {
$connection->write("Hello " . $connection->getRemoteAddress() . "!\n");
$connection->on('data', function($data) use ($connection){
$connection->write('received: ' . strtoupper($data));
});
});
echo "Listening on {$socket->getAddress()}\n";
$loop->run();
Server:
Listening on tcp://127.0.0.1:8000
Client:
websocat ws://localhost:8000
websocat: WebSocketError: HTTP failure
websocat: error running