tôi bắt đầu học sử dụng thư viện khổ thơ và khi tôi sử dụng AddHandler để phân tích phản ứng có vẻ như read-only cho nút đầu tiên của phản ứng xml nên khi tôi nhận được một xml như thế:Có đúng là Strophe.addHandler chỉ đọc nút đầu tiên từ phản hồi không?
<body xmlns='http://jabber.org/protocol/httpbind'>
<presence xmlns='jabber:client' from='[email protected]' to='[email protected]' type='avaliable' id='5593:sendIQ'>
<status/>
</presence>
<presence xmlns='jabber:client' from='[email protected]' to='[email protected]' xml:lang='en'>
<status />
</presence>
<iq xmlns='jabber:client' from='[email protected]' to='[email protected]' type='result'>
<query xmlns='jabber:iq:roster'>
<item subscription='both' name='test' jid='[email protected]'>
<group>test group</group>
</item>
</query>
</iq>
</body>
Với testHandler xử lý sử dụng như thế:
connection.addHandler(testHandler,null,"presence");
function testHandler(stanza){
console.log(stanza);
}
Nó chỉ ghi:
<presence xmlns='jabber:client' from='[email protected]' to='[email protected]' type='avaliable' id='5593:sendIQ'>
<status/>
</presence>
gì tôi đang thiếu? nó là một hành vi đúng đắn? Tôi có nên thêm nhiều người xử lý để có được các stanzas khác không? Cảm ơn trước