-
Connect to server.
-
generateKey() : stringGenerate key.
-
Normalize header.
-
Send a message to the server.
-
run() : voidStart listening.
-
Set a callback to execute when a message arrives.
-
Set a callback to execute every few milliseconds.
-
public function connect(string $address, variable $headers)
Connect to server. -
protected function generateKey()
Generate key. -
protected function normalizeHeaders(array $headers)
Normalize header. -
public function send(string $data, string $opcode)
Send a message to the server. -
public function run()
Start listening. -
public function onMessage(callable $callback)
Set a callback to execute when a message arrives.The callable will receive the message string and the server instance. -
public function onTick(callable $callback)
Set a callback to execute every few milliseconds.The callable will receive the server instance. If it returns boolean `false` the client will stop listening.