Below is a specification draft for the IDLE
command. See Motivation
for the use-case.
When connecting to soju from a phone for a long period of time, battery
consumption becomes too high. This is mainly because every message soju
sends results in a wake-up of downstream's antenna and CPU. The IDLE
command allows a client to tell soju to send messages sparsely, so that
the number of wake-ups is reduced.
The IDLE
command is a command that can only be sent by clients. It
has an optional parameter: a list of comma (,
) separated nicknames,
called highlights.
Servers MAY advertise the IDLE
ISUPPORT token. This token has no
value. Servers that advertise this token support the IDLE
command.
When a server receives the IDLE
command from a client, its connection
with the client becomes idle. When a server receives a command other
than IDLE
from a client with an idle connection, the connection
becomes back to normal (not idle).
When a connection is idle, messages to be sent to the client are buffered on the server until one of the following happens:
In this case, the server sends all buffered messages to the client, and starts buffering messages again.
Case of a client that makes a connection idle, then turns it back to normal with a ping:
C: IDLE taiite,taite,hhirtz
C: PING 25E3CFB
Changed, as per delthas and emersion's request
In this case, the server sends all buffered messages to the client in as few TCP segments as possible, and starts buffering messages again.
to
In this case, the server sends all buffered messages to the client, and starts buffering messages again.
Changed, as per Sir Delthas' forceful (doki doki) demand
- the server buffers a PRIVMSG or NOTICE whose content contains one of the highlights, whose source is the client or whose target is the client,
to
- the server buffers a PRIVMSG or NOTICE whose content contains one of the highlights or whose target is the client,
To help tracking improvement I'm sharing battery usage on my phone in different use case. This showcase that the battery consumtion is excessive.
Client connected to soju with an upstream with lots of messages:
![]()
Client connected to soju with an upstream with no messages at all:
![]()
WIP patch for this: https://github.com/emersion/soju/pull/24
Note, Android and iOS policies are leaning towards making IDLE impossible to use.