上下文:
我试图从后端生成一个会话,从我的前端附加到它。在此过程中,我将请求发送到ejabberd,发送到侦听端口5280的mod_http_bind模块,如metajack.im post中所述。
会话ID请求使用this script发送。
我使用外部身份验证,并且在正常时间通过XMPP或WebAdmin直接连接时效果很好。
问题:
它会生成会话ID,但它需要大约1-3分钟。在此之后我的波什聊天客户端通过超时。除此之外,它对于一个简单的会话ID来说太多了。
有什么建议吗?
额外信息:
这是我的ejabberd日志:
ejabberd日志
2015-12-14 15:52:34.655 [info] <0.490.0>@ejabberd_listener:accept:299 (#Port<0.3971>) Accepted connection 127.0.0.1:49840 -> 127.0.0.1:5280
2015-12-14 15:52:34.655 [info] <0.713.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.3971>}
2015-12-14 15:53:43.187 [info] <0.490.0>@ejabberd_listener:accept:299 (#Port<0.3972>) Accepted connection 127.0.0.1:49855 -> 127.0.0.1:5280
2015-12-14 15:53:43.187 [info] <0.715.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.3972>}
error.log中
--empty--
CRASH.LOG
--empty--
Ejabberd版本:
15.11
ejabberd.log,在调试时使用log_level
2015-12-14 16:20:19.170 [info] <0.1240.0>@ejabberd_listener:accept:299 (#Port<0.7839>) Accepted connection 127.0.0.1:50027 -> 127.0.0.1:5280
2015-12-14 16:20:19.170 [debug] <0.1241.0>@ejabberd_http:init:153 S: [{[<<"register">>],mod_register_web},{[<<"admin">>],ejabberd_web_admin},{[<<"http-bind">>],mod_http_bind}]
2015-12-14 16:20:19.170 [info] <0.1241.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.7839>}
2015-12-14 16:20:19.170 [debug] <0.1241.0>@ejabberd_http:process_header:280 (#Port<0.7839>) http query: 'POST' <<"/http-bind">>
2015-12-14 16:20:19.170 [debug] <0.1241.0>@ejabberd_http:extract_path_query:392 client data: <<"<body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' to='chatdomain' window='5' xml:lang='en' rid='1598394' hold='1' wait='70'/>">>
2015-12-14 16:20:19.170 [debug] <0.1241.0>@ejabberd_http:process:350 [<<"http-bind">>] matches [<<"http-bind">>]
2015-12-14 16:20:19.170 [debug] <0.1241.0>@mod_http_bind:process:68 Incoming data: <body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' to='chatdomain' window='5' xml:lang='en' rid='1598394' hold='1' wait='70'/>
2015-12-14 16:20:19.171 [debug] <0.1241.0>@ejabberd_http_bind:parse_request:1114 --- incoming data ---
<body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' to='chatdomain' window='5' xml:lang='en' rid='1598394' hold='1' wait='70'/>
--- END ---
2015-12-14 16:20:19.171 [debug] <0.1241.0>@ejabberd_http_bind:start:154 Starting session
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:init:339 started: {<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>,<<>>,{{127,0,0,1},50027}}
2015-12-14 16:20:19.176 [debug] <0.1241.0>@ejabberd_http_bind:handle_session_start:282 got pid: <0.1242.0>
2015-12-14 16:20:19.176 [debug] <0.1241.0>@ejabberd_http_bind:handle_session_start:321 Create session: <<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>
2015-12-14 16:20:19.176 [debug] <0.1241.0>@ejabberd_http_bind:http_put:775 Looking for session: <<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:handle_sync_event:442 New request: {http_put,1598394,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"to">>,<<"chatdomain">>},{<<"window">>,<<"5">>},{<<"xml:lang">>,<<"en">>},{<<"rid">>,<<"1598394">>},{<<"hold">>,<<"1">>},{<<"wait">>,<<"70">>}],[],155,1,{<<"chatdomain">>,<<>>},{{127,0,0,1},50027}}
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:handle_http_put_event:558 New request: {http_put,1598394,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"to">>,<<"chatdomain">>},{<<"window">>,<<"5">>},{<<"xml:lang">>,<<"en">>},{<<"rid">>,<<"1598394">>},{<<"hold">>,<<"1">>},{<<"wait">>,<<"70">>}],[],155,1,{<<"chatdomain">>,<<>>},{{127,0,0,1},50027}}
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:591 Actually processing request: {http_put,1598394,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"to">>,<<"chatdomain">>},{<<"window">>,<<"5">>},{<<"xml:lang">>,<<"en">>},{<<"rid">>,<<"1598394">>},{<<"hold">>,<<"1">>},{<<"wait">>,<<"70">>}],[],155,1,{<<"chatdomain">>,<<>>},{{127,0,0,1},50027}}
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:642 -- SaveKey:
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:654 reqlist: [{hbr,1598394,<<>>,[]}]
2015-12-14 16:20:19.176 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:700 really sending now: []
2015-12-14 16:20:19.278 [debug] <0.1241.0>@ejabberd_http_bind:prepare_response:900 OutPacket: [{xmlstreamstart,<<"stream:stream">>,[{<<"xml:lang">>,<<"en">>},{<<"xmlns">>,<<"jabber:client">>},{<<"xmlns:stream">>,<<"http://etherx.jabber.org/streams">>},{<<"id">>,<<"108440446">>},{<<"from">>,<<"chatdomain">>}]}]
2015-12-14 16:20:19.279 [info] <0.1240.0>@ejabberd_listener:accept:299 (#Port<0.7846>) Accepted connection 127.0.0.1:50028 -> 127.0.0.1:5280
2015-12-14 16:20:19.279 [debug] <0.1244.0>@ejabberd_http:init:153 S: [{[<<"register">>],mod_register_web},{[<<"admin">>],ejabberd_web_admin},{[<<"http-bind">>],mod_http_bind}]
2015-12-14 16:20:19.279 [info] <0.1244.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.7846>}
2015-12-14 16:20:19.279 [debug] <0.1244.0>@ejabberd_http:process_header:280 (#Port<0.7846>) http query: 'POST' <<"/http-bind">>
2015-12-14 16:20:19.279 [debug] <0.1244.0>@ejabberd_http:extract_path_query:392 client data: <<"<body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' rid='1598395' xml:lang='en' sid='92c4475848d8b8f10b4dbe1a66980c385f46ac00'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AGFkbWluADEyMzQ=\n</auth></body>">>
2015-12-14 16:20:19.279 [debug] <0.1244.0>@ejabberd_http:process:350 [<<"http-bind">>] matches [<<"http-bind">>]
2015-12-14 16:20:19.279 [debug] <0.1244.0>@mod_http_bind:process:68 Incoming data: <body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' rid='1598395' xml:lang='en' sid='92c4475848d8b8f10b4dbe1a66980c385f46ac00'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AGFkbWluADEyMzQ=
</auth></body>
2015-12-14 16:20:19.279 [debug] <0.1244.0>@ejabberd_http_bind:parse_request:1114 --- incoming data ---
<body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' rid='1598395' xml:lang='en' sid='92c4475848d8b8f10b4dbe1a66980c385f46ac00'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AGFkbWluADEyMzQ=
</auth></body>
--- END ---
2015-12-14 16:20:19.279 [debug] <0.1244.0>@ejabberd_http_bind:http_put:775 Looking for session: <<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>
2015-12-14 16:20:19.279 [debug] <0.1242.0>@ejabberd_http_bind:handle_sync_event:442 New request: {http_put,1598395,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"rid">>,<<"1598395">>},{<<"xml:lang">>,<<"en">>},{<<"sid">>,<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>}],[{xmlel,<<"auth">>,[{<<"xmlns">>,<<"urn:ietf:params:xml:ns:xmpp-sasl">>},{<<"mechanism">>,<<"PLAIN">>}],[{xmlcdata,<<"AGFkbWluADEyMzQ=\n">>}]}],255,1,<<>>,{{127,0,0,1},50028}}
2015-12-14 16:20:19.280 [debug] <0.1242.0>@ejabberd_http_bind:handle_http_put_event:558 New request: {http_put,1598395,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"rid">>,<<"1598395">>},{<<"xml:lang">>,<<"en">>},{<<"sid">>,<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>}],[{xmlel,<<"auth">>,[{<<"xmlns">>,<<"urn:ietf:params:xml:ns:xmpp-sasl">>},{<<"mechanism">>,<<"PLAIN">>}],[{xmlcdata,<<"AGFkbWluADEyMzQ=\n">>}]}],255,1,<<>>,{{127,0,0,1},50028}}
2015-12-14 16:20:19.280 [debug] <0.1242.0>@ejabberd_http_bind:rid_allow:852 Previous rid / New rid: 1598394/1598395
2015-12-14 16:20:19.280 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:591 Actually processing request: {http_put,1598395,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"rid">>,<<"1598395">>},{<<"xml:lang">>,<<"en">>},{<<"sid">>,<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>}],[{xmlel,<<"auth">>,[{<<"xmlns">>,<<"urn:ietf:params:xml:ns:xmpp-sasl">>},{<<"mechanism">>,<<"PLAIN">>}],[{xmlcdata,<<"AGFkbWluADEyMzQ=\n">>}]}],255,1,<<>>,{{127,0,0,1},50028}}
2015-12-14 16:20:19.280 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:642 -- SaveKey:
2015-12-14 16:20:19.280 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:654 reqlist: [{hbr,1598395,<<>>,[]},{hbr,1598394,<<>>,[{xmlstreamstart,<<"stream:stream">>,[{<<"xml:lang">>,<<"en">>},{<<"xmlns">>,<<"jabber:client">>},{<<"xmlns:stream">>,<<"http://etherx.jabber.org/streams">>},{<<"id">>,<<"108440446">>},{<<"from">>,<<"chatdomain">>}]}]}]
2015-12-14 16:20:19.280 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:700 really sending now: [{xmlel,<<"auth">>,[{<<"xmlns">>,<<"urn:ietf:params:xml:ns:xmpp-sasl">>},{<<"mechanism">>,<<"PLAIN">>}],[{xmlcdata,<<"AGFkbWluADEyMzQ=\n">>}]}]
^[OF2015-12-14 16:21:29.387 [info] <0.1240.0>@ejabberd_listener:accept:299 (#Port<0.7847>) Accepted connection 127.0.0.1:50030 -> 127.0.0.1:5280
2015-12-14 16:21:29.388 [debug] <0.1245.0>@ejabberd_http:init:153 S: [{[<<"register">>],mod_register_web},{[<<"admin">>],ejabberd_web_admin},{[<<"http-bind">>],mod_http_bind}]
2015-12-14 16:21:29.388 [info] <0.1245.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.7847>}
2015-12-14 16:21:29.388 [debug] <0.1245.0>@ejabberd_http:process_header:280 (#Port<0.7847>) http query: 'POST' <<"/http-bind">>
2015-12-14 16:21:29.388 [debug] <0.1245.0>@ejabberd_http:extract_path_query:392 client data: <<"<body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' rid='1598396' xml:lang='en' sid='92c4475848d8b8f10b4dbe1a66980c385f46ac00'/>">>
2015-12-14 16:21:29.388 [debug] <0.1245.0>@ejabberd_http:process:350 [<<"http-bind">>] matches [<<"http-bind">>]
2015-12-14 16:21:29.388 [debug] <0.1245.0>@mod_http_bind:process:68 Incoming data: <body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' rid='1598396' xml:lang='en' sid='92c4475848d8b8f10b4dbe1a66980c385f46ac00'/>
2015-12-14 16:21:29.388 [debug] <0.1245.0>@ejabberd_http_bind:parse_request:1114 --- incoming data ---
<body xmlns='http://jabber.org/protocol/httpbind' content='text/xml; charset=utf-8' rid='1598396' xml:lang='en' sid='92c4475848d8b8f10b4dbe1a66980c385f46ac00'/>
--- END ---
2015-12-14 16:21:29.388 [debug] <0.1245.0>@ejabberd_http_bind:http_put:775 Looking for session: <<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:handle_sync_event:442 New request: {http_put,1598396,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"rid">>,<<"1598396">>},{<<"xml:lang">>,<<"en">>},{<<"sid">>,<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>}],[],160,1,<<>>,{{127,0,0,1},50030}}
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:handle_http_put_event:558 New request: {http_put,1598396,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"rid">>,<<"1598396">>},{<<"xml:lang">>,<<"en">>},{<<"sid">>,<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>}],[],160,1,<<>>,{{127,0,0,1},50030}}
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:rid_allow:852 Previous rid / New rid: 1598395/1598396
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:591 Actually processing request: {http_put,1598396,[{<<"xmlns">>,<<"http://jabber.org/protocol/httpbind">>},{<<"content">>,<<"text/xml; charset=utf-8">>},{<<"rid">>,<<"1598396">>},{<<"xml:lang">>,<<"en">>},{<<"sid">>,<<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>}],[],160,1,<<>>,{{127,0,0,1},50030}}
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:642 -- SaveKey:
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:654 reqlist: [{hbr,1598396,<<>>,[]},{hbr,1598395,<<>>,[]}]
2015-12-14 16:21:29.389 [debug] <0.1242.0>@ejabberd_http_bind:process_http_put:700 really sending now: []
2015-12-14 16:23:09.492 [info] <0.1242.0>@ejabberd_http_bind:handle_info:507 Session timeout. Closing the HTTP bind session: <<"92c4475848d8b8f10b4dbe1a66980c385f46ac00">>
2015-12-14 16:23:09.492 [debug] <0.1242.0>@ejabberd_http_bind:terminate:538 terminate: Deleting session 92c4475848d8b8f10b4dbe1a66980c385f46ac00
答案 0 :(得分:1)
我在BoshClient脚本中犯了一个错误。 在那里,在&#34; startSessionAndAuth&#34;方法,你可以设置&#34;等待&#34;价值,我不知道你可能想要等待的阶段但是......默认设置为70秒。我将其设置为0,现在立即响应新的会话ID。
注意:仅支持轮询会话的客户端可能会阻止 连接管理员等待设置&#39;等待&#39;或者&#39;持有&#39;到&#34; 0&#34;。 但是,由于相关的增加,因此不建议进行民意调查 带宽消耗和响应性的降低都是 通常是一个或两个数量级!
这完全是我的理由。