Skip to content

Releases: amphp/websocket-client

1.0.0 RC1

09 Sep 14:44
63499f4

Choose a tag to compare

1.0.0 RC1 Pre-release
Pre-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.

0.2.4

06 Feb 15:38
6f25a62

Choose a tag to compare

  • 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).

0.2.3

30 Jan 16:52
162a7ac

Choose a tag to compare

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

0.2.2

19 Dec 15:36
v0.2.2

Choose a tag to compare

  • 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.

0.2.1

17 Dec 16:24
v0.2.1

Choose a tag to compare

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

0.2.0

16 Dec 22:07
v0.2.0
69e3ac5

Choose a tag to compare

  • Major API rewrite based on Amp v2.

0.1.0

10 Jul 15:45

Choose a tag to compare

  • Release for Amp v1.