The Wayback Machine - https://web.archive.org/web/20200904152525/https://github.com/amphp/websocket-client/releases
Skip to content

@trowski trowski released this Jul 5, 2020 · 2 commits to master since this release

Changes since RC2

  • Removed header methods from Connection. Now the Response object is available with Connection::getResponse(), which provides access to the response headers and other response data.
  • Removed the connector() function, so there is no longer a global Connector object.
  • Fixed Handshake::withHeaders() to remove all prior set headers as expected.
  • Added ConnectContext parameter to connect() function.
  • ConnectionException now extends HttpException from amphp/http-client.

Upgrading from v0.2.x to v1.0

This library has been refactored to use the new amphp/websocket library containing components that can be shared between server and clients.

The simplest way to use this library is with the connect() function to initiate a WebSocket connection.

$connection = yield Amp\Websocket\Client\connect('ws://localhost:1337/broadcast');
yield $connection->send('Hello!');

/** @var Amp\Websocket\Message $message */
while ($message = yield $connection->receive()) {
    $payload = yield $message->buffer();
    // $payload now contains the entire message content
    yield $connection->send('Received message with length ' . strlen($payload));
}

Custom request headers and connections options can be set using the Handshake class and passing this object to connect() instead of a string URI. Connection behavior can be further customized by using an instance of Connector to establish a connection instead of the connect() function.

WebSocket clients are now represented by Connection, which extends the Client object from amphp/websocket. This object contains several methods for getting information about the client, fetching the headers returned in the server response, and sending/receiving messages.

Assets 2
Pre-release
Pre-release

@trowski trowski released this Feb 29, 2020 · 17 commits to master since this release

  • This library now uses HttpClient from amphp/http-client to send connection requests. As such, Rfc6455Connector requires an instance of HttpClient when constructed. The client may have various interceptors attached to modify behavior when connecting.
  • Updated to league/uri@^6, subsequently PHP 7.2+ is now required.
Assets 2
Pre-release
Pre-release

@trowski trowski released this Sep 9, 2019 · 25 commits to master since this release

This library has been refactored to use the new amphp/websocket library containing components that can be shared between server and clients.

Note: This is a pre-release, there might be breaking changes in the final stable version.

The simplest way to use this library is with the connect() function to initiate a WebSocket connection.

$connection = yield Amp\Websocket\Client\connect('ws://localhost:1337/broadcast');
yield $connection->send('Hello!');

/** @var Amp\Websocket\Message $message */
while ($message = yield $connection->receive()) {
    $payload = yield $message->buffer();
    // $payload now contains the entire message content
    yield $connection->send('Received message with length ' . strlen($payload));
}

Custom request headers and connections options can be set using the Handshake class and passing this object to connect() instead of a string URI. Connection behavior can be customized using the Connector interface or by extending the existing Rfc6455Connector class.

WebSocket clients are now represented by Connection, which extends the Client object from amphp/websocket. This object contains several methods for getting information about the client, fetching the headers returned in the server response, and sending/receiving messages.

Assets 2

@trowski trowski released this Feb 6, 2019 · 62 commits to master since this release

  • Fixed incorrect dependency that was only being loaded in dev mode.
  • Fixed port being added to host header if the port is non-standard (e.g., not 80/443).
Assets 2

@trowski trowski released this Jan 30, 2019 · 65 commits to master since this release

  • Fixed response header parsing (#16)
  • Fixed close code byte order and close reason (#15)
Assets 2

@kelunik kelunik released this Dec 19, 2017 · 71 commits to master since this release

  • Reject connections if RSV is not equals to 0.
  • Validate close reasons to be valid UTF-8 if UTF-8 validation has been requested.
  • Accept zero-length frames starting a message.
  • Deliver stored messages correctly if they're immediately followed by a close.
  • Reject continuations if there's no started message.
  • Disable streaming for frames. A single frame is now always buffered. A message can still be streamed via multiple frames.
Assets 2

@kelunik kelunik released this Dec 17, 2017 · 82 commits to master since this release

  • Fix handshake if no port is given in URL.
  • Correctly validate handshake response headers.
Assets 2

@kelunik kelunik released this Dec 16, 2017 · 88 commits to master since this release

  • Major API rewrite based on Amp v2.
Assets 2

@trowski trowski released this Jul 10, 2017

  • Release for Amp v1.
Assets 2
You can’t perform that action at this time.