This page aims to give a general overview of how Prosody is structured internally, and how all the different pieces fit together.
Responsible for loading the configuration file and performing a lot of initialisation and loading of the various pieces of the server.
It currently also opens all the ports used by the server (though this will be changed in the future).
net.server is a Lua socket framework, originally from the Luadch project by 'blastbeat'. Prosody's version has some differences, but we try to keep in sync with the original version, and are working towards a generic module which will be useful to other Lua server projects also.
net.server handles opening server sockets, accepting connections, and also creating outgoing connections (e.g. for s2s). Each server port and outgoing connection has a listener object which receives events through 2 methods it implements, 'incoming' and 'disconnect' (previously 'incoming' was called 'listener').
Prosody includes several standard listener types, and abstraction for opening a server port with a given listener. Current listeners include 'xmppclient', 'xmppserver', 'httpserver' and 'xmppcomponent' (for external components).
You can manage connlisteners through the net.connlisteners library.
core.sessionmanager handles the logic for client connections. Most functions are invoked by the xmppclient listener. It is the module in charge of creating/destroying client session objects.
core.s2smanager implements the logic for handling s2s connections, both incoming and outgoing. It contains high-level functions for sending stanzas to remote domains, as well as creating/destroying s2s session objects.