Menu

Reference / Http\WebSocket

Message

finalclass
final class Message

One received message.

$data is the whole message after fragments are reassembled and, when permessage-deflate is on, decompressed. A text message is guaranteed to be valid UTF-8 (otherwise the connection closes with 1007). $binary tells a binary message from a text one.

See also: Connection::receive

Methods

__construct()Create a message.

__construct()#source

function __construct(public string $data, public bool $binary)

Create a message. Received messages are built by the connection; this is useful for tests and fakes.

Parameters

$data string
the message payload
$binary bool
true for a binary message, false for text

View source