Why do all twisted/wokkel xmpp examples ignore the proper usage of JID in the xmpp protocol?
In this particular case, the better answer to the non-question is that you should not set the from address at all. Every server will happily fill in the blank for you, saving you from figuring out what JID your client has.
Okay, this isn't a question. All the examples of wokkel and twisted I have seen do not properly observe generated resources in the JID.
Google talk clients built using wokkel/twisted generally break because they do not set the full JID on responses, resulting in (very hidden, low level) errors like:
<message to="example@gmail.com" from="example2@synthasite.com/Example2C2F32A1" type="error"><body>echo: None</body><error code="400" type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">If set, the 'from' attribute must be set to the user's full JID.</text></error></message>
The full, server issued jid can be obtained in the protocol handler from self.parent.authenticator.jid.full()
So, when sending messages, ensure you use the full jid in your from field, or some servers will not like you and you will pull all your hair out, and cry.