SocketClient Changelog


0.7.0 (2017-04-02) Release on GitHub

  • Feature / BC break: Add main Connector facade
    (#93 by @clue)

    The new Connector class acts as a facade for all underlying connectors,
    which are now marked as "advanced usage", but continue to work unchanged.
    This now makes it trivially easy to create plaintext TCP/IP, secure TLS and
    Unix domain socket (UDS) connection streams simply like this:

    $connector = new Connector($loop);
    $connector->connect('tls://')->then(function (ConnectionInterface $conn) {
        $conn->write("GET / HTTP/1.0\r\n\r\n");

    Optionally, it accepts options to configure all underlying connectors, such
    as using a custom DNS setup, timeout values and disabling certain protocols
    and much more. See the README for more details.

0.6.2 (2017-03-17) Release on GitHub

  • Feature / Fix: Support SNI on legacy PHP < 5.6 and add documentation for
    supported PHP and HHVM versions.
    (#90 and #91 by @clue)

0.6.1 (2017-03-10) Release on GitHub

  • Feature: Forward compatibility with Stream v0.5 and upcoming v0.6
    (#89 by @clue)

  • Fix: Fix examples to use updated API
    (#88 by @clue)

0.6.0 (2017-02-17) Release on GitHub

  • Feature / BC break: Use connect($uri) instead of create($host, $port)
    and resolve with a ConnectionInterface instead of Stream
    and expose remote and local addresses through this interface
    and remove superfluous and undocumented ConnectionException.
    (#74, #82 and #84 by @clue)

    // old
    $connector->create('', 80)->then(function (Stream $conn) {
        echo 'Connected' . PHP_EOL;
        $conn->write("GET / HTTP/1.0\r\n\r\n");
    // new
    $connector->connect('')->then(function (ConnectionInterface $conn) {
        echo 'Connected to ' . $conn->getRemoteAddress() . PHP_EOL;
        $conn->write("GET / HTTP/1.0\r\n\r\n");

    Note that both the old Stream and the new ConnectionInterface implement
    the same underlying DuplexStreamInterface, so their streaming behavior is
    actually equivalent.
    In order to upgrade, simply use the new typehints.
    Existing stream handlers should continue to work unchanged.

  • Feature / BC break: All connectors now MUST offer cancellation support.
    You can now rely on getting a rejected promise when calling cancel() on a
    pending connection attempt.
    (#79 by @clue)

    // old: promise resolution not enforced and thus unreliable
    $promise = $connector->create($host, $port);
    $promise->then(/* MAY still be called */, /* SHOULD be called */);
    // new: rejecting after cancellation is mandatory
    $promise = $connector->connect($uri);
    $promise->then(/* MUST NOT be called */, /* MUST be called */);

    Note that this behavior is only mandatory for pending connection attempts.
    Once the promise is settled (resolved), calling cancel() will have no effect.

  • BC break: All connector classes are now marked final
    and you can no longer extend them
    (which was never documented or recommended anyway).
    Please use composition instead of extension.
    (#85 by @clue)


0.5.3 (2016-12-24) Release on GitHub

  • Fix: Skip IPv6 tests if not supported by the system
    (#76 by @clue)
  • Documentation for ConnectorInterface
    (#77 by @clue)

0.5.2 (2016-12-19) Release on GitHub

  • Feature: Replace SecureStream with unlimited read buffer from react/stream v0.4.5
    (#72 by @clue)
  • Feature: Add examples
    (#75 by @clue)

0.4.6 (2016-12-06) Release on GitHub

This is a bugfix release that resolves an issue introduced in the v0.4.5 release.
You should consider upgrading to the v0.5 release.

  • Fix: Always create empty stream context to prevent race condition leading to
    CN mismatch on TLS enabled connections (#73 by @WyriHaximus)

0.5.1 (2016-11-20) Release on GitHub

  • Feature: Support Promise cancellation for all connectors
    (#71 by @clue)

    $promise = $connector->create($host, $port);
  • Feature: Add TimeoutConnector decorator
    (#51 by @clue)

    $timeout = new TimeoutConnector($connector, 3.0, $loop);
    $timeout->create($host, $port)->then(function(Stream $stream) {
        // connection resolved within 3.0s

0.4.5 (2016-03-27) Release on GitHub

This is a compatibility release that backports some changes from the v0.5
release branch. You should consider upgrading to the v0.5 release.

  • Fix: PHP 5.6+ uses new SSL/TLS context options backported (#65 by @clue)
  • Fix: Move SSL/TLS context options to SecureConnector (#43 by @clue)

0.5.0 (2016-03-19) Release on GitHub

  • Feature / BC break: Support Connector without DNS
    (#46 by @clue)

    BC break: The Connector class now serves as a BC layer only.
    The TcpConnector and DnsConnector classes replace its functionality.
    If you're merely using this class, then you're recommended to upgrade as
    per the below snippet – existing code will still work unchanged.
    If you're extending the Connector (generally not recommended), then you
    may have to rework your class hierarchy.

    // old (still supported, but marked deprecated)
    $connector = new Connector($loop, $resolver);
    // new equivalent
    $connector = new DnsConnector(new TcpConnector($loop), $resolver);
    // new feature: supports connecting to IP addresses only
    $connector = new TcpConnector($loop);
  • Feature: Add socket and SSL/TLS context options to connectors
    (#52 by @clue)

  • Fix: PHP 5.6+ uses new SSL/TLS context options
    (#61 by @clue)

  • Fix: Move SSL/TLS context options to SecureConnector
    (#43 by @clue)

  • Fix: Fix error reporting for invalid addresses
    (#47 by @clue)

  • Fix: Close stream resource if connection fails
    (#48 by @clue)

  • First class support for PHP 5.3 through PHP 7 and HHVM
    (#53, #54 by @clue)

  • Add integration tests for SSL/TLS sockets
    (#62 by @clue)


0.4.4 (2015-09-23) Release on GitHub

  • Feature: Add support for Unix domain sockets (UDS) (#41 by @clue)
  • Bugfix: Explicitly set supported TLS versions for PHP 5.6+ (#31 by @WyriHaximus)
  • Bugfix: Ignore SSL non-draining buffer workaround for PHP 5.6.8+ (#33 by @alexmace)

0.4.3 (2015-03-20) Release on GitHub

  • Bugfix: Set peer name to hostname to correct security concern in PHP 5.6 (@WyriHaximus)
  • Bugfix: Always wrap secure to pull buffer due to regression in PHP
  • Bugfix: SecureStream extends Stream to match documentation preventing BC (@clue)


0.4.2 (2014-10-16) Release on GitHub

Phergilicious: In honour of all the SSL bugs found by the Phergie project re-writing on top of React.

0.4.0 (2014-02-02) Release on GitHub

  • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
  • BC break: Update to React/Promise 2.0
  • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
  • Bump React dependencies to v0.4


0.3.1 (2013-04-20) Release on GitHub

  • Feature: [SocketClient] Support connecting to IPv6 addresses (@clue)

0.3.0 (2013-04-14) Release on GitHub

  • Feature: [SocketClient] New SocketClient component extracted from HttpClient (@clue)