0

首先,提前感谢您和我一起看这个问题。

我目前正在使用 strophe.js 通过 BOSH 连接连接到旁遮普邦,最终将消息转发到 Openfire。我在服务器上预绑定并附加到与 strophe 的连接。这最初工作正常;我可以发送和接收消息,当我收到空闲 ping 时,我能够成功响应。但是,一段时间后,我会断开连接。

检查旁遮普日志后,当我从 strophe 发送消息时,似乎并不总是从旁遮普得到 httpbind 确认。Strophe 按预期等待大约 60 秒,然后尝试再次发送消息 - 具有相同 ID 的完整副本。这是有道理的,因为它不知道旁遮普是否收到了这条消息,因为它从未承认过。然而,由于某种原因,旁遮普省收到了这条重复消息,并认为它是一个带有不正确 RID 的新消息,因此它增加了它的内部 RID 计数器,就像它会增加任何其他消息一样。此外,它再次将消息转发到 Openfire 服务器,尽管据我所知,我还没有看到这有任何显着影响。最后,在这种情况发生了很多次之后,

我的问题是,为什么旁遮普邦没有按应有的方式承认一些信息——回到<body xmlns='http://jabber.org/protocol/httpbind'/>strophe。

此过程通过以下日志中的示例进行了详细说明:

    2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410643.66:                 Punjab gets a message from the HTTP Bind (this is why we are observing activity in HTTPChannel)
    2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :                                        This is the POST message coming from the BOSH connection
    2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1]                                                                    You can see that it is in an httpbind protocol body
                    <body rid='1211827046' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
                                    <iq type='result' to='codemonkey' id='511-862' xmlns='jabber:client'/>
                    </body>
    2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] 1211827046
    2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1]                                                                    Here, Punjab strips the httpbind body and sends the root message directly to OpenFire
                    SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>                                                      using the direct session connection Punjab has set up for this user (evidenced by the SID).
                    SEND: "
                    <iq xmlns='jabber:client' to='codemonkey' type='result' id='511-862'/>"


                    HOWEVER, HERE WE ARE MISSING THE HTTPBIND CONFIRMATION THAT SHOULD BE SENT BACK TO STROPHE, LETTING IT KNOW THAT THE MESSAGE WAS FORWARDED
                    THUS, STROPHE SENDS THE SAME MESSAGE AGAIN WITH THE SAME RID, THINKING THAT PUNJAB NEVER GOT THE FIRST ONE.


    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410708.95:                 Punjab gets a message from the HTTP Bind (this is strophes second attempt at sending the message)
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 
                    <body rid='1211827046' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
                                    <iq type='result' to='codemonkey' id='511-862' xmlns='jabber:client'/>
                    </body>
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 1211827046
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 
                    SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>                                                      PUNJAB SENDS THIS TO OPENFIRE AS WELL, EVIDENCE THAT PUNJAB FAILS TO DETECT THAT THIS IS A DUPLICATE MESSAGE
                    SEND: "                                                                                                                                                 It seems that Openfire must disregard this, considering that we haven’t seen issues with openfire receiving these messages.
                    <iq xmlns='jabber:client' to='codemonkey' type='result' id='511-862'/>"               and haven’t seen duplicate messages through chat or anything.
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1]        RETURN HTTPB 1340410708.95:
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1]                                                                    PUNJAB SENDS OUT THE HTTPBIND ACKNOWLEDGEMENT, AS IT SHOULD HAVE THE FIRST TIME.
                    <body xmlns='http://jabber.org/protocol/httpbind'/>
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 1211827046
    2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:18:28 +0000] "POST /bosh HTTP/1.1" 200 51 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"


    Since Punjab sees the duplicate request as a new request, it has incremented its internal RID counter for both, meaning we are now off by 1 RID (each message sent from strophe is supposed to increment the RID value by 1). The first few times this happens, the connection remains because Punjab has a tolerance window of about 5. Eventually, we get out of this window, and Punjab closes the connection.


    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 
                    <body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
                                    <iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
                    </body>
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052                  ITS INTERNAL RID COUNTER HAS INCREASED TO 52 WHILE WE ARE AT 48.
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404                                                                   The tolerance has been exceeded and the connection is closed.
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"


    Since Punjab sees the duplicate request as a new request, it has incremented its internal RID counter for both, meaning we are now off by 1 RID (each message sent from strophe is supposed to increment the RID value by 1). The first few times this happens, the connection remains because Punjab has a tolerance window of about 5. Eventually, we get out of this window, and Punjab closes the connection.


    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 
                    <body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
                                    <iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
                    </body>
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052                  ITS INTERNAL RID COUNTER HAS INCREASED TO 52 WHILE WE ARE AT 48.
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404                                                                   The tolerance has been exceeded and the connection is closed.
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"

任何帮助将不胜感激。也许我不完全理解旁遮普在做什么。在我看来,旁遮普邦通过 BOSH 从打包在 httpbind 正文中的 strophe 中获取消息。它从 httpbind 正文中提取消息并通过直接会话将裸消息转发给 Openfire。最后,它通过返回一个裸消息来响应 strophe <body xmlns='http://jabber.org/protocol/httpbind'/>,让 strophe 知道该消息已被接收并处理。当消息来自 Openfire 时,它​​们会显示在 [XmlStream,client] 标头下的日志中,而不是 [HTTPChannel,21,127.0.0.1] 标头下。这些来自 Openfire 通过直接会话连接,Punjab 将它们包装在 httpbind 主体中,然后通过 BOSH 将它们转发到 strophe。Strophe 然后返回一个空<body xmlns='http://jabber.org/protocol/httpbind'/>的确认交易。

那么为什么旁遮普邦有时不承认该信息呢?为什么它没有将重复的消息视为重复消息而只是返回确认而不是重新发送它并错误地增加它的 RID 计数器?再一次,谢谢你,谢谢你,谢谢你读到这里。我无能为力,任何帮助将不胜感激。

这是失败的完整旁遮普日志:

    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410782.18:
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 
        <body rid='1211827046' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
            <iq type='result' to='codemonkey' id='511-862' xmlns='jabber:client'/>
        </body>
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 1211827046
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1]        RETURN HTTPB 1340410782.2:
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 
        <body xmlns='http://jabber.org/protocol/httpbind'>
            <iq xmlns='jabber:client' from='codemonkey' type='get' id='64-863' to='MySiteadmin@codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
                <ping xmlns='urn:xmpp:ping'/>
            </iq>
        </body>
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 1211827046
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:19:42 +0000] "POST /bosh HTTP/1.1" 200 222 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410782.34:
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 
        <body rid='1211827047' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
            <iq type='result' to='codemonkey' id='64-863' xmlns='jabber:client'/>
        </body>
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 1211827047
    2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 
        SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => 
        SEND: "
        <iq xmlns='jabber:client' to='codemonkey' type='result' id='64-863'/>"





    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410850.19:
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 
        <body rid='1211827047' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
            <iq type='result' to='codemonkey' id='64-863' xmlns='jabber:client'/>
        </body>
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 1211827047
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 
        SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => 
        SEND: "
        <iq xmlns='jabber:client' to='codemonkey' type='result' id='64-863'/>"
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1]        RETURN HTTPB 1340410850.21:
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 
        <body xmlns='http://jabber.org/protocol/httpbind'/>
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 1211827047
    2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:20:49 +0000] "POST /bosh HTTP/1.1" 200 51 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"





    2012-06-22 20:22:00-0400 [XmlStream,client] 
        SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => 
        RECV: '
        <iq type="get" id="600-864" from="codemonkey" to="MySiteadmin@codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5">
            <ping xmlns="urn:xmpp:ping"/>
        </iq>'
    2012-06-22 20:22:00-0400 [XmlStream,client]        RETURN HTTPB 1340410920.62:
    2012-06-22 20:22:00-0400 [XmlStream,client] 
        <body xmlns='http://jabber.org/protocol/httpbind'>
            <iq xmlns='jabber:client' from='codemonkey' type='get' id='600-864' to='MySiteadmin@codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
                <ping xmlns='urn:xmpp:ping'/>
            </iq>
        </body>
    2012-06-22 20:22:00-0400 [XmlStream,client] 1211827047
    2012-06-22 20:22:00-0400 [XmlStream,client] 127.0.0.1 - - [23/Jun/2012:00:21:59+0000] "POST /bosh HTTP/1.1" 200 223 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"





    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410927.48:
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 
        <body rid='1211827047' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
            <iq type='result' to='codemonkey' id='64-863' xmlns='jabber:client'/>
        </body>
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 1211827047
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1]        RETURN HTTPB 1340410927.48:
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 
        <body xmlns='http://jabber.org/protocol/httpbind'>
            <iq xmlns='jabber:client' from='codemonkey' type='get' id='600-864' to='MySiteadmin@codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
                <pingxmlns='urn:xmpp:ping'/>
            </iq>
        </body>
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 1211827047
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:22:06 +0000] "POST /bosh HTTP/1.1" 200 223 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410927.67:
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 
        <body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
            <iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
        </body>
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 1211827048
    2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 
        SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => 
        SEND: "
        <iq xmlns='jabber:client' to='codemonkey' type='result' id='600-864'/>"





    2012-06-22 20:22:12-0400 [-] 
        SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => 
        SEND: ' '





    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 
        <body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
            <iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
        </body>
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404
    2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"





    2012-06-22 20:23:23-0400 [XmlStream,client] 
        SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => 
        RECV: '
        <iq type="get" id="180-865" from="codemonkey" to="MySiteadmin@codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5">
            <ping xmlns="urn:xmpp:ping"/>
        </iq>'
    2012-06-22 20:23:23-0400 [XmlStream,client]        RETURN HTTPB 1340411003.49:
    2012-06-22 20:23:23-0400 [XmlStream,client] 
        <body xmlns='http://jabber.org/protocol/httpbind'>
            <iq xmlns='jabber:client' from='codemonkey' type='get' id='180-865' to='MySiteadmin@codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
                <ping xmlns='urn:xmpp:ping'/>
            </iq>
        </body>
    2012-06-22 20:23:23-0400 [XmlStream,client] 1211827048
    2012-06-22 20:23:23-0400 [XmlStream,client] 127.0.0.1 - - [23/Jun/2012:00:23:23+0000] "POST /bosh HTTP/1.1" 200 223 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
4

1 回答 1

0

事实证明,我对旁遮普的理解是有缺陷的。空<body xmlns='http://jabber.org/protocol/httpbind'/>消息实际上并不用于通过 BOSH 连接确认消息。由于 BOSH 使用长轮询技术,客户端使用空的 httpbind 主体初始化连接。服务器在指定的等待时间内保持此连接打开 - 即 60 秒。如果在 60 秒标记之前没有收到任何消息,服务器会通过响应一个空的 httpbind 正文来关闭连接,并且客户端会通过向服务器发送另一个空正文来重新打开一个新的连接。

我的问题源于我在 C# 中使用 MatriX 库初始化预绑定连接。连接保持打开的默认等待时间为 300 秒。因此,它会建立与旁遮普语的连接以在 300 秒后关闭连接。但是,strophe 的默认等待时间是 60 秒。当我使用 strophe 连接到现有的 MatriX 连接时,strophe 变得混乱,因为旁遮普语没有像预期的那样在 60 秒内释放连接。

解决方法是将 strophe 等待时间更改为 300 秒以匹配 MatriX 设置条件。

于 2012-06-25T17:27:11.647 回答