Wrench\Client¶
-
class
Client¶ Client class
Represents a Wrench client
-
constant
MAX_HANDSHAKE_RESPONSE¶
-
property
uri¶ protected
-
property
origin¶ protected
-
property
socket¶ protected
-
property
headers¶ protected array
Request headers
-
property
protocol¶ protected Protocol
Protocol instance
-
property
options¶ protected array
Options
-
property
connected¶ protected boolean
Whether the client is connected
-
__construct($uri, $origin, $options = array())¶ Constructor
Parameters: - $uri (string) –
- $origin (string) – The origin to include in the handshake (required in later versions of the protocol)
- $options –
-
configure($options)¶ Configure options
Parameters: - $options (array) –
Returns: void
-
__destruct()¶ Destructor
-
addRequestHeader($name, $value)¶ Adds a request header to be included in the initial handshake
For example, to include a Cookie header
Parameters: - $name (string) –
- $value (string) –
Returns: void
-
sendData($data, $type = 'text', $masked = true)¶ Sends data to the socket
Parameters: - $data (string) –
- $type (string) – Payload type
- $masked (boolean) –
Returns: int bytes written
-
connect()¶ Connect to the Wrench server
Returns: boolean Whether a new connection was made
-
isConnected()¶ Whether the client is currently connected
Returns: boolean
-
disconnect()¶
-
constant