Skip to content

Instantly share code, notes, and snippets.

View Sebastix's full-sized avatar

Sebastian Hagens Sebastix

View GitHub Profile
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\StreamHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Pool;
use GuzzleHttp\Psr7\Response;
@Sebastix
Sebastix / test-async-guzzle.php
Last active September 27, 2024 13:18
Http/Guzzle async websocket request
<?php
$handlerStack = new HandlerStack(new StreamHandler());
$handlerStack->push(new WebSocketMiddleware());
$guzzle = new Client(['handler' => $handlerStack]);
// Execute async call
// TODO: research what we can do with this payload array
$payload = [];
@Sebastix
Sebastix / test-async-guzzle-websocket.php
Created September 16, 2024 13:44
Async Guzzle request with websocket endpoint
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Handler\StreamHandler;
use GuzzleHttp\HandlerStack;
use Valtzu\WebSocketMiddleware\WebSocketMiddleware;
use Valtzu\WebSocketMiddleware\WebSocketStream;