src/whatsprot.class.php
public function sendMessageRead($to, $id)
    {
        $listNode = null;
        $idNode = $id;
        if (is_array($id) && count($id > 1)) {
            $idNode = array_shift($id);
            foreach ($id as $itemId) {
                $items[] = new ProtocolNode('item',
                [
                  'id' => $itemId,
                ], null, null);
            }
            $listNode = new ProtocolNode('list', null, $items, null);
        }

        $messageNode = new ProtocolNode('receipt',
        [
          'type' => 'read',
          't'    => time(),
          'to'   => $this->getJID($to),
          'id'   => $idNode,
        ], [$listNode], null);

        $this->sendNode($messageNode);
    }
public function sendMessageRead($to, $id)
    {
        $listNode = null;
        $idNode = $id;
        if (is_array($id) && count($id > 1)) {
            $idNode = array_shift($id);
            foreach ($id as $itemId) {
                $items[] = new ProtocolNode('item',
                [
                  'id' => $itemId,
                ], null, null);
            }
            $listNode = new ProtocolNode('list', null, $items, null);
        }

        $messageNode = new ProtocolNode('receipt',
        [
          'type' => 'read',
          't'    => time(),
          'to'   => $this->getJID($to),
          'id'   => $idNode,
        ], [$listNode], null);

        $this->sendNode($messageNode);
    }
public function sendMessageRead ( $ to , $ id ) { $ listNode = null ; $ idNode = $ id ; if ( is_array ( $ id ) && count ( $ id > 1 ) ) { $ idNode = array_shift ( $ id ) ; foreach ( $ id as $ itemId ) { $ items [ ] = new ProtocolNode ( 'item' , [ 'id' => $ itemId , ] , null , null ) ; } $ listNode = new ProtocolNode ( 'list' , null , $ items , null ) ; } $ messageNode = new ProtocolNode ( 'receipt' , [ 'type' => 'read' , 't' => time ( ) , 'to' => $ this -> getJID ( $ to ) , 'id' => $ idNode , ] , [ $ listNode ] , null ) ; $ this -> sendNode ( $ messageNode ) ; }
Send a read receipt to a message.

@param string                $to The recipient.
@param mixed String or Array $id
Send a read receipt to a message .