<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>

<!--
     ASCII to XML transformation by Invisible Worlds, Inc.
     http://invisible.net/
     Last transformation: 03-Feb-1999, 02:04:18

     Cannonical version of this document is at:
     http://info.internet.isi.edu/in-notes/rfc/files/rfc2177.txt

     Implementors should verify all content with
     cannonical version.  Failure to do so may result in
     protocol failures.
-->

<rfc number="2177"
     category="std">
<front>
<title>IMAP4 IDLE command</title>
<author initials="B." surname="Leiba" fullname="Barry Leiba">
<organization>IBM T.J. Watson Research Center</organization>
<address>
<postal>
<street>30 Saw Mill River Road</street>
<street>Hawthorne</street>
<street>NY  10532</street>
</postal>
<email>leiba@watson.ibm.com</email>
</address>
</author>
<date month="June" year="1997"/>
<area>Applications</area>
<keyword>IMAP</keyword>
<keyword>internet message access protocol</keyword>
</front>
<middle>
<!-- RFC original section: (1.) -->
<section title="Abstract">
<t>
   The Internet Message Access Protocol <xref target="_XREF_IMAP4"/> requires a client to
   poll the server for changes to the selected mailbox (new mail,
   deletions).  It&apos;s often more desirable to have the server transmit
   updates to the client in real time.  This allows a user to see new
   mail immediately.  It also helps some real-time applications based on
   IMAP, which might otherwise need to poll extremely often (such as
   every few seconds).  (While the spec actually does allow a server to
   push EXISTS responses aysynchronously, a client can&apos;t expect this
   behaviour and must poll.)
</t>
<t>
   This document specifies the syntax of an IDLE command, which will
   allow a client to tell the server that it&apos;s ready to accept such
   real-time updates.
</t>
</section>
<!-- RFC original section: (2.) -->
<section title="Conventions Used in this Document">
<t>
   In examples, &quot;C:&quot; and &quot;S:&quot; indicate lines sent by the client and
   server respectively.
</t>
<t>
   The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, and &quot;MAY&quot;
   in this document are to be interpreted as described in RFC 2060
   <xref target="_XREF_IMAP4"/>.
</t>
</section>
<!-- RFC original section: (3.) -->
<section title="Specification">
<t>
   IDLE Command
</t>
<figure><artwork>
   Arguments:  none

   Responses:  continuation data will be requested; the client sends
               the continuation data &quot;DONE&quot; to end the command
   Result:     OK - IDLE completed after client sent &quot;DONE&quot;
               NO - failure: the server will not allow the IDLE
                    command at this time
              BAD - command unknown or arguments invalid
</artwork></figure>
<t>
   The IDLE command may be used with any IMAP4 server implementation
   that returns &quot;IDLE&quot; as one of the supported capabilities to the
   CAPABILITY command.  If the server does not advertise the IDLE
   capability, the client MUST NOT use the IDLE command and must poll
   for mailbox updates.  In particular, the client MUST continue to be
   able to accept unsolicited untagged responses to ANY command, as
   specified in the base IMAP specification.
</t>
<t>
   The IDLE command is sent from the client to the server when the
   client is ready to accept unsolicited mailbox update messages.  The
   server requests a response to the IDLE command using the continuation
   (&quot;+&quot;) response.  The IDLE command remains active until the client
   responds to the continuation, and as long as an IDLE command is
   active, the server is now free to send untagged EXISTS, EXPUNGE, and
   other messages at any time.
</t>
<t>
   The IDLE command is terminated by the receipt of a &quot;DONE&quot;
   continuation from the client; such response satisfies the server&apos;s
   continuation request.  At that point, the server MAY send any
   remaining queued untagged responses and then MUST immediately send
   the tagged response to the IDLE command and prepare to process other
   commands. As in the base specification, the processing of any new
   command may cause the sending of unsolicited untagged responses,
   subject to the ambiguity limitations.  The client MUST NOT send a
   command while the server is waiting for the DONE, since the server
   will not be able to distinguish a command from a continuation.
</t>
<t>
   The server MAY consider a client inactive if it has an IDLE command
   running, and if such a server has an inactivity timeout it MAY log
   the client off implicitly at the end of its timeout period.  Because
   of that, clients using IDLE are advised to terminate the IDLE and
   re-issue it at least every 29 minutes to avoid being logged off.
   This still allows a client to receive immediate mailbox updates even
   though it need only &quot;poll&quot; at half hour intervals.
</t>
<figure><artwork>
   Example:    C: A001 SELECT INBOX
               S: * FLAGS (Deleted Seen)
               S: * 3 EXISTS
               S: * 0 RECENT
               S: * OK [UIDVALIDITY 1]
               S: A001 OK SELECT completed
               C: A002 IDLE
               S: + idling
               ...time passes; new mail arrives...
               S: * 4 EXISTS
               C: DONE
               S: A002 OK IDLE terminated
               ...another client expunges message 2 now...
               C: A003 FETCH 4 ALL
               S: * 4 FETCH (...)
               S: A003 OK FETCH completed
               C: A004 IDLE
               S: * 2 EXPUNGE
               S: * 3 EXISTS
               S: + idling
               ...time passes; another client expunges message 3...
               S: * 3 EXPUNGE
               S: * 2 EXISTS
               ...time passes; new mail arrives...
               S: * 3 EXISTS
               C: DONE
               S: A004 OK IDLE terminated
               C: A005 FETCH 3 ALL
               S: * 3 FETCH (...)
               S: A005 OK FETCH completed
               C: A006 IDLE
</artwork></figure>
</section>
<!-- RFC original section: (4.) -->
<section title="Formal Syntax">
<t>
   The following syntax specification uses the augmented Backus-Naur
   Form (BNF) notation as specified in [RFC-822] as modified by <xref target="_XREF_IMAP4"/>.
   Non-terminals referenced but not defined below are as defined by
   <xref target="_XREF_IMAP4"/>.
</t>
<figure><artwork>
   command_auth    ::= append / create / delete / examine / list / lsub /
                       rename / select / status / subscribe / unsubscribe
                       / idle
                       ;; Valid only in Authenticated or Selected state

   idle            ::= &quot;IDLE&quot; CRLF &quot;DONE&quot;
</artwork></figure>
</section>
<!-- RFC original section: (5.) -->
<section title="References (BOILERPLATE)">
<t>
This RFC contained boilerplate in this section which has been moved
to the RFC2223-compliant unnumbered section &quot;References.&quot;
</t>
</section>
<!-- RFC original section: (6.) -->
<section title="Security Considerations">
<t>
   There are no known security issues with this extension.
</t>
</section>
<!-- RFC original section: (7.) -->
<section title="Author&apos;s Address (BOILERPLATE)">
<t>
This RFC contained boilerplate in this section which has been moved
to the RFC2223-compliant unnumbered section &quot;Author&apos;s Address.&quot;
</t>
</section>
</middle>
<back>
<!-- BEGIN INCLUDE REFERENCES ** DO NOT REMOVE -->
<references>
<reference anchor="_XREF_IMAP4">
<front>
<title abbrev="Internet Message Access Protocol">Internet Message Access Protocol - Version 4rev1,&quot;</title>
<author initials="M." surname="Crispin" fullname="M. Crispin">
<organization/>
</author>
<date month="December" year="1996"/>
</front>
<seriesInfo>RFC 2060</seriesInfo>
</reference>
</references>
<!-- END INCLUDE REFERENCES ** DO NOT REMOVE -->
</back>
</rfc>
