| 1 | Structure of a session: |
| 2 | |
| 3 | |
| 4 | session { |
| 5 | -- properties -- |
| 6 | conn -- the tcp connection |
| 7 | notopen -- true if stream has not been initiated, removed after receiving <stream:steam> |
| 8 | type -- the connection type. Valid values include: |
| 9 | -- "c2s_unauthed" - connection has not been authenticated yet |
| 10 | -- "c2s" - from a local client to the server |
| 11 | username -- the node part of the client's jid (not defined before auth) |
| 12 | host -- the host part of the client's jid (not defined before stream initiation) |
| 13 | resource -- the resource part of the client's full jid (not defined before resource binding) |
| 14 | full_jid -- convenience for the above 3 as string in username@host/resource form (not defined before resource binding) |
| 15 | priority -- the resource priority, default: 0 |
| 16 | presence -- the last non-directed presence with no type attribute. initially nil. reset to nil on unavailable presence. |
| 17 | interested -- true if the resource requested the roster. Interested resources recieve roster updates. Initially nil. |
| 18 | roster -- the user's roster. Loaded as soon as the resource is bound (session becomes a connected resource). |
| 19 | |
| 20 | -- methods -- |
| 21 | send(x) -- converts x to a string, and writes it to the connection |
| 22 | disconnect(x) -- Disconnect the user and clean up the session, best call sessionmanager.destroy_session() instead of this in most cases |
| 23 | } |
| 24 | |
| 25 | if session.full_jid (also session.roster and session.resource) then this is a "connected resource" |
| 26 | if session.presence then this is an "available resource" (all available resources are connected resources) |
| 27 | if session.interested then this is an "interested resource" (all interested resources are connected resources) |