WebSocket::send PHP Method

send() public method

public send ( $client, $msg )
    function send($client, $msg)
    {
        $this->say("> " . $msg);
        $msg = $this->wrap($msg);
        socket_write($client, $msg, strlen($msg));
    }

Usage Example

Example #1
0
 /**
  * Updates the clients presence.
  *
  * @param WebSocket $ws 
  * @param string|null $gamename 
  * @param boolean $idle
  * @return boolean 
  */
 public function updatePresence($ws, $gamename, $idle)
 {
     $idle = $idle == false ? null : true;
     $ws->send(['op' => 3, 'd' => ['game' => !is_null($gamename) ? ['name' => $gamename] : null, 'idle_since' => $idle]]);
     return true;
 }
All Usage Examples Of WebSocket::send