rfc2177.IMAP4_IDLE_command.txt 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. Network Working Group B. Leiba
  2. Request for Comments: 2177 IBM T.J. Watson Research Center
  3. Category: Standards Track June 1997
  4. IMAP4 IDLE command
  5. Status of this Memo
  6. This document specifies an Internet standards track protocol for the
  7. Internet community, and requests discussion and suggestions for
  8. improvements. Please refer to the current edition of the "Internet
  9. Official Protocol Standards" (STD 1) for the standardization state
  10. and status of this protocol. Distribution of this memo is unlimited.
  11. 1. Abstract
  12. The Internet Message Access Protocol [IMAP4] requires a client to
  13. poll the server for changes to the selected mailbox (new mail,
  14. deletions). It's often more desirable to have the server transmit
  15. updates to the client in real time. This allows a user to see new
  16. mail immediately. It also helps some real-time applications based on
  17. IMAP, which might otherwise need to poll extremely often (such as
  18. every few seconds). (While the spec actually does allow a server to
  19. push EXISTS responses aysynchronously, a client can't expect this
  20. behaviour and must poll.)
  21. This document specifies the syntax of an IDLE command, which will
  22. allow a client to tell the server that it's ready to accept such
  23. real-time updates.
  24. 2. Conventions Used in this Document
  25. In examples, "C:" and "S:" indicate lines sent by the client and
  26. server respectively.
  27. The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
  28. in this document are to be interpreted as described in RFC 2060
  29. [IMAP4].
  30. 3. Specification
  31. IDLE Command
  32. Arguments: none
  33. Responses: continuation data will be requested; the client sends
  34. the continuation data "DONE" to end the command
  35. Leiba Standards Track [Page 1]
  36. RFC 2177 IMAP4 IDLE command June 1997
  37. Result: OK - IDLE completed after client sent "DONE"
  38. NO - failure: the server will not allow the IDLE
  39. command at this time
  40. BAD - command unknown or arguments invalid
  41. The IDLE command may be used with any IMAP4 server implementation
  42. that returns "IDLE" as one of the supported capabilities to the
  43. CAPABILITY command. If the server does not advertise the IDLE
  44. capability, the client MUST NOT use the IDLE command and must poll
  45. for mailbox updates. In particular, the client MUST continue to be
  46. able to accept unsolicited untagged responses to ANY command, as
  47. specified in the base IMAP specification.
  48. The IDLE command is sent from the client to the server when the
  49. client is ready to accept unsolicited mailbox update messages. The
  50. server requests a response to the IDLE command using the continuation
  51. ("+") response. The IDLE command remains active until the client
  52. responds to the continuation, and as long as an IDLE command is
  53. active, the server is now free to send untagged EXISTS, EXPUNGE, and
  54. other messages at any time.
  55. The IDLE command is terminated by the receipt of a "DONE"
  56. continuation from the client; such response satisfies the server's
  57. continuation request. At that point, the server MAY send any
  58. remaining queued untagged responses and then MUST immediately send
  59. the tagged response to the IDLE command and prepare to process other
  60. commands. As in the base specification, the processing of any new
  61. command may cause the sending of unsolicited untagged responses,
  62. subject to the ambiguity limitations. The client MUST NOT send a
  63. command while the server is waiting for the DONE, since the server
  64. will not be able to distinguish a command from a continuation.
  65. The server MAY consider a client inactive if it has an IDLE command
  66. running, and if such a server has an inactivity timeout it MAY log
  67. the client off implicitly at the end of its timeout period. Because
  68. of that, clients using IDLE are advised to terminate the IDLE and
  69. re-issue it at least every 29 minutes to avoid being logged off.
  70. This still allows a client to receive immediate mailbox updates even
  71. though it need only "poll" at half hour intervals.
  72. Leiba Standards Track [Page 2]
  73. RFC 2177 IMAP4 IDLE command June 1997
  74. Example: C: A001 SELECT INBOX
  75. S: * FLAGS (Deleted Seen)
  76. S: * 3 EXISTS
  77. S: * 0 RECENT
  78. S: * OK [UIDVALIDITY 1]
  79. S: A001 OK SELECT completed
  80. C: A002 IDLE
  81. S: + idling
  82. ...time passes; new mail arrives...
  83. S: * 4 EXISTS
  84. C: DONE
  85. S: A002 OK IDLE terminated
  86. ...another client expunges message 2 now...
  87. C: A003 FETCH 4 ALL
  88. S: * 4 FETCH (...)
  89. S: A003 OK FETCH completed
  90. C: A004 IDLE
  91. S: * 2 EXPUNGE
  92. S: * 3 EXISTS
  93. S: + idling
  94. ...time passes; another client expunges message 3...
  95. S: * 3 EXPUNGE
  96. S: * 2 EXISTS
  97. ...time passes; new mail arrives...
  98. S: * 3 EXISTS
  99. C: DONE
  100. S: A004 OK IDLE terminated
  101. C: A005 FETCH 3 ALL
  102. S: * 3 FETCH (...)
  103. S: A005 OK FETCH completed
  104. C: A006 IDLE
  105. 4. Formal Syntax
  106. The following syntax specification uses the augmented Backus-Naur
  107. Form (BNF) notation as specified in [RFC-822] as modified by [IMAP4].
  108. Non-terminals referenced but not defined below are as defined by
  109. [IMAP4].
  110. command_auth ::= append / create / delete / examine / list / lsub /
  111. rename / select / status / subscribe / unsubscribe
  112. / idle
  113. ;; Valid only in Authenticated or Selected state
  114. idle ::= "IDLE" CRLF "DONE"
  115. Leiba Standards Track [Page 3]
  116. RFC 2177 IMAP4 IDLE command June 1997
  117. 5. References
  118. [IMAP4] Crispin, M., "Internet Message Access Protocol - Version
  119. 4rev1", RFC 2060, December 1996.
  120. 6. Security Considerations
  121. There are no known security issues with this extension.
  122. 7. Author's Address
  123. Barry Leiba
  124. IBM T.J. Watson Research Center
  125. 30 Saw Mill River Road
  126. Hawthorne, NY 10532
  127. Email: leiba@watson.ibm.com
  128. Leiba Standards Track [Page 4]