Input is ignored when a lot of data is received from the server at once.
There are two (almost identical, but not quite) cases:
First, the most obvious, is when we receive a huge stanza. For example a
huge list of items like this
(of course we could use result-set-management to avoid that big stanza, but we don’t always have this possibility, and the server may not support it anyway)
In that case, the list of items is handled with just one function that
loops over each items and processes them one by one, without a break,
and without giving the possibility to the keyboard to be handled during
The result is that the keyboard is completely ignored during that time.
A solution would be to restore the event queue that was in sleekxmpp (but was implemented with threads which, as you all know, suck), and to use it to process “big stanzas that may contain a lot of items” (for example the room list, the roster, etc) like this: for each item in the stanza, insert a function in that queue. And then, in the main asyncio loop, that queue would be emptied (each item would be processed) one by one, with the same priority as the keyboard or other timers.
The second case is when we receive a lot of stanzas at once, but not
necessarily big ones. For example if we join a room with a lot of people
in it, we receive each presence in a different stanza. But since we may
recv() a lot of data on the socket at once, and since we immediately
handle ALL the stanzas that were found in that data (say we receive 4096
bytes, in this contains 50
these 50 stanzas will be handled without a break), we have this “lag”
A solution is (like for the first issue), instead of processing the stanza immediately, to insert them in the event queue and to dequeue that in the main loop, with the same priority as the keyboard and other timers.