ice framework documentation ice doc v1.10.1
Methods
  • connect(string $address, variable $headers) : void
    Connect to server.
  • generateKey() : string
    Generate key.
  • normalizeHeaders(array $headers) : array
    Normalize header.
  • send(string $data, string $opcode) : bool
    Send a message to the server.
  • run() : void
    Start listening.
  • onMessage(callable $callback) : void
    Set a callback to execute when a message arrives.
  • onTick(callable $callback) : void
    Set a callback to execute every few milliseconds.
Methods Details
  • 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.