KB07080101 IMAP and the IDLE command
IMAP provides immediate notification by use of the IDLE command protocol extension.
How IDLE Works
IMAP works by the client sending commands to Mailtraq.
Mailtraq provides two things in response to a client command:
- An response to the request.
- Information about any new messages.
So, when the client is actively doing things, it will be told straightaway about new messages: an active client will always be kept up to date.
The IDLE command copes when the client has no more requests to make. Mailtraq responds to the IDLE command when there is a new message and tells the client.
When the user is inactive, the client simply stops using IDLE, which is very efficient. The basic network use of the IDLE command is very small, and so it makes very efficient use of bandwidth.
In reality things are a little more complicated as timeouts occur when there is no activity keeping the connection open. There are two main timeouts:
IMAP server timeout:
Mailtraq's default setting is after 600 seconds with no activity.
NAT Gateway timeout:
These will typically time out an idle connection after 15 minutes.
So, Mailtraq supports the NOOP (No Operation) command which allows the client to exchange a few bytes of data every few minutes to keep everything live.
IDLE allows Mailtraq to provide a good IMAP service with the least network impact.