## Client [Mix WebSocket](https://github.com/mix-php/websocket) 库本身提供了 Client 类: - 创建拨号器,拨号一个连接 ~~~ $dialer = new \Mix\WebSocket\Client\Dialer(); $conn = $dialer->dial('ws://www.domain.com/websocket'); ~~~ - 通过连接发送数据 ~~~ $frame = new \Swoole\WebSocket\Frame(); $frame->data = 'xiaoming'; $conn->send($frame); ~~~ - 通过连接接收数据 ~~~ while(true) { $frame = $conn->recv(); // $conn->close 或者连接异常断开时会抛出异常 var_dump($frame->data); } ~~~