好吧,这不是问题。我看到的所有 wokkel 和 twisted 的例子都没有正确观察 JID 中生成的资源。
使用 wokkel/twisted 构建的 Google Talk 客户端通常会中断,因为它们没有在响应中设置完整的 JID,从而导致(非常隐藏、低级别)错误,例如:
<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>
可以在协议处理程序中从 self.parent.authenticator.jid.full() 获取完整的、服务器发出的 jid
因此,在发送消息时,请确保您在 from 字段中使用完整的 jid,否则某些服务器不会喜欢您,您会拉出所有的头发,然后哭泣。