See also: source code
Todo: review https://nyco.wordpress.com/2016/04/21/3-gens-of-im-next-steps-for-xmpp/ for good ideas for our roadmap