phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

Type alias not resolve in `vendor`

Open ging-dev opened this issue 1 year ago • 0 comments

Step to reproduce:

composer require amphp/websocket-client
use Amp\Websocket\Client\WebsocketHandshake;
use Amp\Websocket\WebsocketCloseCode;
use function Amp\Websocket\Client\connect;

// Connects to the websocket endpoint at libwebsockets.org
// which sends a message every 50ms.
$handshake = (new WebsocketHandshake('wss://libwebsockets.org'))
    ->withHeader('Sec-WebSocket-Protocol', 'dumb-increment-protocol'); // Argument '2' passed to withHeader() is expected to be of type HeaderParamValueType, string given (HeaderParamValueType is type alias)

$connection = connect($handshake);

foreach ($connection as $message) {
    $payload = $message->buffer();

    printf("Received: %s\n", $payload);

    if ($payload === '100') {
        $connection->close();
        break;
    }
}

ging-dev avatar Sep 15 '24 11:09 ging-dev