v0.7.0
版本发布时间: 2017-04-10 20:10:13
reactphp/socket最新发布版本:v1.16.0(2024-07-26 18:39:34)
-
Feature: Merge SocketClient component into this component (#87 by @clue)
This means that this package now provides async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.
$connector = new React\Socket\Connector($loop); $connector->connect('google.com:80')->then(function (ConnectionInterface $conn) { $connection->write('…'); });
Accordingly, the
ConnectionInterface
is now used to represent both incoming server side connections as well as outgoing client side connections.If you've previously used the SocketClient component to establish outgoing client connections, upgrading should take no longer than a few minutes. All classes have been merged as-is from the latest
v0.7.0
release with no other changes, so you can simply update your code to use the updated namespace like this:// old from SocketClient component and namespace $connector = new React\SocketClient\Connector($loop); $connector->connect('google.com:80')->then(function (ConnectionInterface $conn) { $connection->write('…'); }); // new $connector = new React\Socket\Connector($loop); $connector->connect('google.com:80')->then(function (ConnectionInterface $conn) { $connection->write('…'); });