websocket客户端
amphp/websocket-client是基于AmpPHP异步WebSocket客户端。
安装
该软件包可以作为依赖项安装。
composer require amphp/websocket-client
要求
PHP 7.2以上
文档和示例
更广泛的代码示例位于目录中。
use Amp \ Websocket \ Client \ Connection ;
use Amp \ Websocket \ Message ;
use function Amp \delay;
use function Amp \ Websocket \ Client \connect;
// Connects to the Kaazing echoing websocket demo.
Amp \ Loop :: run ( function () {
/** @var Connection $connection */
$ connection = yield connect ( 'ws://demos.kaazing.com/echo' );
1