You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An invalid request phase transition happens if the connection isn't properly established, here because dum-increment-protocol is passed instead of dumb-increment-protocol.
<?phprequire\dirname(__DIR__) . '/vendor/autoload.php';
useAmp\Websocket\Client\WebsocketHandshake;
usefunctionAmp\Websocket\Client\connect;
// Connects to the websocket endpoint at libwebsockets.org which sends a message every 50ms.$handshake = (newWebsocketHandshake('wss://libwebsockets.org'))
->withHeader('Sec-WebSocket-Protocol', 'dum-increment-protocol');
$connection = connect($handshake);
while ($message = $connection->receive()) {
$payload = $message->buffer();
\printf("Received: %s\n", $payload);
if ($payload === '100') {
$connection->close();
break;
}
}
➜ php examples/libwebsockets.org.php
Fatal error: Uncaught Error: Invalid request phase transition from ServerProcessing to Connect in /Users/kelunik/PHP/amphp/websocket-client/vendor/amphp/http-client/src/Internal/EventInvoker.php on line 85
Error: Invalid request phase transition from ServerProcessing to Connect in /Users/kelunik/PHP/amphp/websocket-client/vendor/amphp/http-client/src/Internal/EventInvoker.php on line 85
Call Stack:
0.0406 5097232 1. {fiber:1053903C0}() /Users/kelunik/PHP/amphp/websocket-client/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:498
0.0406 5117712 2. Revolt\EventLoop\Driver\StreamSelectDriver->Revolt\EventLoop\Internal\{closure:/Users/kelunik/PHP/amphp/websocket-client/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:560-622}() /Users/kelunik/PHP/amphp/websocket-client/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:498
0.2997 6165592 3. Revolt\EventLoop\Driver\StreamSelectDriver->invokeMicrotasks() /Users/kelunik/PHP/amphp/websocket-client/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:616
0.2999 6171544 4. Amp\{closure:/Users/kelunik/PHP/amphp/websocket-client/vendor/amphp/amp/src/functions.php:23-37}() /Users/kelunik/PHP/amphp/websocket-client/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:425
0.2999 6171704 5. Amp\Http\Client\Connection\DefaultConnectionFactory->create() /Users/kelunik/PHP/amphp/websocket-client/vendor/amphp/amp/src/functions.php:33
0.3000 6171704 6. Amp\Http\Client\Internal\EventInvoker->connectStart() /Users/kelunik/PHP/amphp/websocket-client/vendor/amphp/http-client/src/Connection/DefaultConnectionFactory.php:33
The text was updated successfully, but these errors were encountered:
An invalid request phase transition happens if the connection isn't properly established, here because
dum-increment-protocol
is passed instead ofdumb-increment-protocol
.The text was updated successfully, but these errors were encountered: