首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ejabberd 14.12 mod_mam多会话问题

Ejabberd 14.12 mod_mam多会话问题
EN

Stack Overflow用户
提问于 2015-01-22 16:08:42
回答 2查看 743关注 0票数 0

我已经使用启用的多会话和工作mod_mam配置了ejabberd 14.12服务器(XEP-0313 v0.2,https://github.com/kongo2002/ejabberd-mod-mamhttp://xmpp.org/extensions/attic/xep-0313-0.2.html)

当我从具有一个连接会话的用户发送消息给一个会话的不同用户时,mod_mam工作得很好。

但是,如果用户-1@示例有两个具有不同资源的联机会话,并且user-2@示例发送给用户-1@示例(到裸JID),则一条消息- mod_mam保存两条消息。

ejabberd日志:

代码语言:javascript
复制
<0.708.0>@ejabberd_http_bind:http_put:792 Looking for session: <<"2a16b709927907352b5696d8c7fbb4bdc641c736">>
<0.606.0>@ejabberd_http_bind:handle_sync_event:440 New request: {http_put,152025,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"rid">>,<<"152025">>},{<<"sid">>,<<"2a16b709927907352b5696d8c7fbb4bdc641c736">>},{<<"key">>,<<"e9815d19f02d2ca9249209cdd82c818fae01b821">>}],[{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}],251,1,<<>>,{{10,0,2,2},49075}}
<0.606.0>@ejabberd_http_bind:handle_http_put_event:575 New request: {http_put,152025,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"rid">>,<<"152025">>},{<<"sid">>,<<"2a16b709927907352b5696d8c7fbb4bdc641c736">>},{<<"key">>,<<"e9815d19f02d2ca9249209cdd82c818fae01b821">>}],[{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}],251,1,<<>>,{{10,0,2,2},49075}}
<0.606.0>@ejabberd_http_bind:rid_allow:866 Previous rid / New rid: 152024/152025
<0.606.0>@ejabberd_http_bind:process_http_put:608 Actually processing request: {http_put,152025,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"rid">>,<<"152025">>},{<<"sid">>,<<"2a16b709927907352b5696d8c7fbb4bdc641c736">>},{<<"key">>,<<"e9815d19f02d2ca9249209cdd82c818fae01b821">>}],[{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}],251,1,<<>>,{{10,0,2,2},49075}}
<0.606.0>@ejabberd_http_bind:process_http_put:619 Key/OldKey/NextKey: e9815d19f02d2ca9249209cdd82c818fae01b821/4b0850aed0c7d411c41f28c041f0e176db7cf4d7/4b0850aed0c7d411c41f28c041f0e176db7cf4d7
<0.606.0>@ejabberd_http_bind:process_http_put:659  -- SaveKey: e9815d19f02d2ca9249209cdd82c818fae01b821
<0.606.0>@ejabberd_http_bind:process_http_put:671 reqlist: [{hbr,152025,<<"4b0850aed0c7d411c41f28c041f0e176db7cf4d7">>,[]},{hbr,152024,<<"882220e875a29152d9b15510b8673137e8360e42">>,[]}]
<0.606.0>@ejabberd_http_bind:process_http_put:717 really sending now: [{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}]
<0.607.0>@ejabberd_router:do_route:322 route
    from {jid,<<"user-2">>,<<"ch">>,<<"ch_jsjac">>,<<"user-2">>,<<"ch">>,<<"ch_jsjac">>}
    to {jid,<<"user-1">>,<<"ch">>,<<>>,<<"user-1">>,<<"ch">>,<<>>}
    packet {xmlel,<<"message">>,[{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}
<0.607.0>@ejabberd_local:do_route:296 local route
    from {jid,<<"user-2">>,<<"ch">>,<<"ch_jsjac">>,<<"user-2">>,<<"ch">>,<<"ch_jsjac">>}
    to {jid,<<"user-1">>,<<"ch">>,<<>>,<<"user-1">>,<<"ch">>,<<>>}
    packet {xmlel,<<"message">>,[{<<"to">>,<<"user"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
<0.607.0>@ejabberd_sm:do_route:514 session manager
    from {jid,<<"user-2">>,<<"ch">>,<<"ch_jsjac">>,<<"user-2">>,<<"ch">>,<<"ch_jsjac">>}
    to {jid,<<"user-1">>,<<"ch">>,<<>>,<<"user-1">>,<<"ch">>,<<>>}
    packet {xmlel,<<"message">>,[{<<"to">>,<<"user"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
<0.607.0>@ejabberd_sm:route_message:658 sending to process <0.586.0>
<0.607.0>@ejabberd_sm:route_message:658 sending to process <0.649.0>
<0.615.0>@ejabberd_http_bind:prepare_response:914 OutPacket: [{xmlstreamelement,{xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ch_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}}]
<0.615.0>@ejabberd_http_bind:send_outpacket:1056  --- outgoing data --- 
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns='jabber:client' from='user-2@example/ch_jsjac' to='user-1@example' type='chat'><body>2-222</body></message></body>
 --- END --- 
<0.580.0>@ejabberd_http_bind:prepare_response:914 OutPacket: [{xmlstreamelement,{xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ch_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}}]
<0.580.0>@ejabberd_http_bind:send_outpacket:1056  --- outgoing data --- 
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns='jabber:client' from='user-2@example/ch_jsjac' to='user-1@example' type='chat'><body>2-222</body></message></body>
 --- END --- 
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ch_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ch_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"2-222">>}]}]}

我们可以从mod_mam中看到双倍的“mod_mam”。

当我从归档中查询消息时,我得到了如下内容:

代码语言:javascript
复制
<message xmlns='jabber:client' from='user-1@example' to='user-1@example/42114606331421936688301010'>
    <result xmlns='urn:xmpp:mam:tmp' id='54C104E31E374104E800009B'>
        <forwarded xmlns='urn:xmpp:forward:0'>
            <delay xmlns='urn:xmpp:delay' stamp='2015-01-22T14:10:43Z'/>
            <message from='user-2@example/8658298161421935653320719' to='user-1@example' type='chat'>
                <body>
                    2-222
                </body>
            </message>
        </forwarded>
    </result>
</message>
<message xmlns='jabber:client' from='user-1@example' to='user-1@example/42114606331421936688301010'>
    <result xmlns='urn:xmpp:mam:tmp' id='54C104E31E374104E800009C'>
        <forwarded xmlns='urn:xmpp:forward:0'>
        <delay xmlns='urn:xmpp:delay' stamp='2015-01-22T14:10:43Z'/>
            <message from='user-2@example/8658298161421935653320719' to='user-1@example' type='chat'>
                <body>
                    2-222
                </body>
            </message>
        </forwarded>
    </result>
</message>

但我只想收到一条没有重复的信息。

类似地,如果用户-1@示例有3个具有不同资源的在线会话,并且用户-2@示例发送给用户-1@示例(用于裸JID),则一条消息- mod_mam保存两条消息。

ejabberd日志:

代码语言:javascript
复制
<0.690.0>@ejabberd_http_bind:http_put:792 Looking for session: <<"2a16b709927907352b5696d8c7fbb4bdc641c736">>
<0.606.0>@ejabberd_http_bind:handle_sync_event:440 New request: {http_put,151909,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"rid">>,<<"151909">>},{<<"sid">>,<<"2a16b709927907352b5696d8c7fbb4bdc641c736">>},{<<"key">>,<<"97451cccc5e5f52563e625169fbc6fecc17ae950">>}],[{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}],251,1,<<>>,{{10,0,2,2},47540}}
<0.606.0>@ejabberd_http_bind:handle_http_put_event:575 New request: {http_put,151909,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"rid">>,<<"151909">>},{<<"sid">>,<<"2a16b709927907352b5696d8c7fbb4bdc641c736">>},{<<"key">>,<<"97451cccc5e5f52563e625169fbc6fecc17ae950">>}],[{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}],251,1,<<>>,{{10,0,2,2},47540}}
<0.606.0>@ejabberd_http_bind:rid_allow:866 Previous rid / New rid: 151908/151909
<0.606.0>@ejabberd_http_bind:process_http_put:608 Actually processing request: {http_put,151909,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"rid">>,<<"151909">>},{<<"sid">>,<<"2a16b709927907352b5696d8c7fbb4bdc641c736">>},{<<"key">>,<<"97451cccc5e5f52563e625169fbc6fecc17ae950">>}],[{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}],251,1,<<>>,{{10,0,2,2},47540}}
<0.606.0>@ejabberd_http_bind:process_http_put:619 Key/OldKey/NextKey: 97451cccc5e5f52563e625169fbc6fecc17ae950/17ba9df4939c3fbd9c7f5021af54e4edb6d11496/17ba9df4939c3fbd9c7f5021af54e4edb6d11496
<0.606.0>@ejabberd_http_bind:process_http_put:659  -- SaveKey: 97451cccc5e5f52563e625169fbc6fecc17ae950
<0.606.0>@ejabberd_http_bind:process_http_put:671 reqlist: [{hbr,151909,<<"17ba9df4939c3fbd9c7f5021af54e4edb6d11496">>,[]},{hbr,151908,<<"7a3ebe3b5639ddcc6f73e004c58966e21364257d">>,[]}]
<0.606.0>@ejabberd_http_bind:process_http_put:717 really sending now: [{xmlel,<<"message">>,[{<<"xmlns">>,<<"jabber:client">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}]
<0.607.0>@ejabberd_router:do_route:322 route
    from {jid,<<"user-2">>,<<"ch">>,<<"ex_jsjac">>,<<"user-2">>,<<"ch">>,<<"ex_jsjac">>}
    to {jid,<<"user-1">>,<<"ch">>,<<>>,<<"user-1">>,<<"ch">>,<<>>}
    packet {xmlel,<<"message">>,[{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}
<0.607.0>@ejabberd_local:do_route:296 local route
    from {jid,<<"user-2">>,<<"ch">>,<<"ex_jsjac">>,<<"user-2">>,<<"ch">>,<<"ex_jsjac">>}
    to {jid,<<"user-1">>,<<"ch">>,<<>>,<<"user-1">>,<<"ch">>,<<>>}
    packet {xmlel,<<"message">>,[{<<"to">>,<<"user"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
<0.607.0>@ejabberd_sm:do_route:514 session manager
    from {jid,<<"user-2">>,<<"ch">>,<<"ex_jsjac">>,<<"user-2">>,<<"ch">>,<<"ex_jsjac">>}
    to {jid,<<"user-1">>,<<"ch">>,<<>>,<<"user-1">>,<<"ch">>,<<>>}
    packet {xmlel,<<"message">>,[{<<"to">>,<<"user"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
<0.607.0>@ejabberd_sm:route_message:658 sending to process <0.586.0>
<0.607.0>@ejabberd_sm:route_message:658 sending to process <0.649.0>
<0.607.0>@ejabberd_sm:route_message:658 sending to process <0.683.0>
<0.615.0>@ejabberd_http_bind:prepare_response:914 OutPacket: [{xmlstreamelement,{xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ex_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}}]
<0.615.0>@ejabberd_http_bind:send_outpacket:1056  --- outgoing data --- 
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns='jabber:client' from='user-2@example/ex_jsjac' to='user-1@example' type='chat'><body>3-333</body></message></body>
 --- END --- 
<0.580.0>@ejabberd_http_bind:prepare_response:914 OutPacket: [{xmlstreamelement,{xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ex_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}}]
<0.580.0>@ejabberd_http_bind:send_outpacket:1056  --- outgoing data --- 
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns='jabber:client' from='user-2@example/ex_jsjac' to='user-1@example' type='chat'><body>3-333</body></message></body>
 --- END --- 
<0.686.0>@ejabberd_http_bind:prepare_response:914 OutPacket: [{xmlstreamelement,{xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ex_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}}]
<0.686.0>@ejabberd_http_bind:send_outpacket:1056  --- outgoing data --- 
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns='jabber:client' from='user-2@example/ex_jsjac' to='user-1@example' type='chat'><body>3-333</body></message></body>
 --- END --- 
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ex_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ex_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}
<0.496.0>@mod_mam:handle_cast:313 Packet: {xmlel,<<"message">>,[{<<"from">>,<<"user-2@example/ex_jsjac">>},{<<"to">>,<<"user-1@example">>},{<<"type">>,<<"chat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"3-333">>}]}]}
<0.580.0>@ejabberd_http:process_header:283 (#Port<0.5639>) http query: 'POST' /http-bind/
<0.580.0>@ejabberd_http:process_request:448 client data: <<"<body rid='568139' sid='fd0a27af99432dc8b6a252ce6dc87e35da715cc1' xmlns='http://jabber.org/protocol/httpbind' key='f4967d3d77af57b2c35847986de0720b8ad6215c' > </body>">>
<0.580.0>@ejabberd_http:process:359 [<<"http-bind">>] matches [<<"http-bind">>]
<0.580.0>@ejabberd_http:process:363 [{'Accept-Language',<<"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4">>},{'Accept-Encoding',<<"gzip, deflate">>},{'Referer',<<"http://localhost:3000/profile">>},{'Accept',<<"*/*">>},{'Content-Type',<<"text/xml; charset=UTF-8">>},{'User-Agent',<<"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36">>},{<<"Origin">>,<<"http://localhost:3000">>},{'Content-Length',<<"166">>},{'Connection',<<"keep-alive">>},{'Host',<<"localhost:5280">>}]
<0.580.0>@mod_http_bind:process:68 Incoming data: <body rid='568139' sid='fd0a27af99432dc8b6a252ce6dc87e35da715cc1' xmlns='http://jabber.org/protocol/httpbind' key='f4967d3d77af57b2c35847986de0720b8ad6215c' > </body>
<0.580.0>@ejabberd_http_bind:parse_request:1128 --- incoming data --- 
<body rid='568139' sid='fd0a27af99432dc8b6a252ce6dc87e35da715cc1' xmlns='http://jabber.org/protocol/httpbind' key='f4967d3d77af57b2c35847986de0720b8ad6215c' > </body>

问题:

  1. mod_mam(XEP-0313)或模块缺陷是正常行为?
  2. 我怎样才能修好它?

关于github的问题:https://github.com/kongo2002/ejabberd-mod-mam/issues/7

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-04-30 16:53:03

mod_mam从ejabberd-的工作完美。问题解决了。

票数 0
EN

Stack Overflow用户

发布于 2015-01-24 09:57:05

从XMPP规范来看,如果您不想从所有资源获取消息,则需要查询完整的JID (使用资源)。这似乎是正确的行为。

参考资料:http://xmpp.org/extensions/xep-0313.html#filter-jid

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28093418

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档