# reply method

Future <void> reply(

1. StanzaHandlerData data,
2. String type,
3. List <XMLNode> children

)

Sends a reply of the stanza in `data` with `type`. Replaces the original stanza's children with `children`.

Note that this function currently only accepts IQ stanzas.

## Implementation

    Future<void> reply(
      StanzaHandlerData data,
      String type,
      List<XMLNode> children,
    ) async {
      assert(
        data.stanza.tag == 'iq',
        'Reply makes little sense for non-IQ stanzas',
      );

      final stanza = data.stanza.copyWith(
        to: data.stanza.from,
        from: data.stanza.to,
        type: type,
        children: children,
      );

      await getAttributes().sendStanza(
        StanzaDetails(
          stanza,
          awaitable: false,
          forceEncryption: data.encrypted,
        ),
      );
    }