Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 某些通过xmpp4r发送的FB聊天信息未被接收_Ruby_Facebook_Xmpp_Facebook Chat - Fatal编程技术网

Ruby 某些通过xmpp4r发送的FB聊天信息未被接收

Ruby 某些通过xmpp4r发送的FB聊天信息未被接收,ruby,facebook,xmpp,facebook-chat,Ruby,Facebook,Xmpp,Facebook Chat,我尝试从一个fb用户向他的一个朋友发送消息。大多数时候,信息都被接收到了。丢失的文件在日志中标记为已发送。用于发送消息的ruby gem是,它反过来使用。 示例缺少的消息是嗨,朋友!2013-09-11 17:46:10+0300其中未收到: Hi, friend! 2013-09-11 17:46:05 +0300 Hi, friend! 2013-09-11 17:46:08 +0300 Hi, friend! 2013-09-11 17:46:13 +0300 Hi, friend! 20

我尝试从一个fb用户向他的一个朋友发送消息。大多数时候,信息都被接收到了。丢失的文件在日志中标记为已发送。用于发送消息的ruby gem是,它反过来使用。 示例缺少的消息是
嗨,朋友!2013-09-11 17:46:10+0300
其中未收到:

Hi, friend! 2013-09-11 17:46:05 +0300
Hi, friend! 2013-09-11 17:46:08 +0300
Hi, friend! 2013-09-11 17:46:13 +0300
Hi, friend! 2013-09-11 17:46:16 +0300
以下是与成功接收消息的日志相似的消息日志:


Debugging mode enabled.
Warnings mode enabled.
RESOLVING:
    _xmpp-client._tcp.chat.facebook.com (SRV)
CONNECTING:
    chat.facebook.com:5222
"Socket:"
"local address: [\"AF_INET\", 39123, \"172.27.*.**\", \"172.27.*.**\"]"
"Thread list size: 1"
#<TCPSocket:fd 11>
SENDING:
    <stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='chat.facebook.com' xml:lang='en' version='1.0' >
RECEIVED:
    <stream:stream from='chat.facebook.com' id='1' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'/>
RECEIVED:
    <stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features>
FEATURES: received
PROCESSING:
    <stream:features xmlns='jabber:client'><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features> (REXML::Element)
FEATURES: waiting...
TRYING stanzacbs...
FEATURES: waiting finished
TRYING message/iq/presence/cbs...
SENDING:
    <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
RECEIVED:
    <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
TLSv1: OpenSSL handshake in progress
TLSv1: restarting parser
"Socket:"
"local address: [\"AF_INET\", 39123, \"172.27.*.**\", \"172.27.*.**\"]"
"Thread list size: 1"
#<TCPSocket:fd 11>
SENDING:
    <stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='chat.facebook.com' xml:lang='en' version='1.0' >
RECEIVED:
    <stream:stream from='chat.facebook.com' id='1' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'/>
RECEIVED:
    <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features>
FEATURES: waiting...
FEATURES: received
PROCESSING:
    <stream:features xmlns='jabber:client'><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features> (REXML::Element)
TRYING stanzacbs...
FEATURES: waiting finished
TRYING message/iq/presence/cbs...
SENDING:
    <auth mechanism='X-FACEBOOK-PLATFORM' xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
RECEIVED:
    <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dmVyc2lvbj0x...</challenge>
SASL DIGEST-MD5 challenge:
    version=1&method=auth.xmpp_login&nonce=E547D1842...
    {"version"=>"1", "method"=>"auth.xmpp_login", "nonce"=>"E547D1842..."}
SENDING:
    <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>YXBpX2...
    </response>
RECEIVED:
    <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
"Socket:"
"local address: [\"AF_INET\", 39123, \"172.27.*.**\", \"172.27.*.**\"]"
"Thread list size: 2"
#<TCPSocket:fd 11>
SENDING:
    <stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='chat.facebook.com' xml:lang='en' version='1.0' >
RECEIVED:
    <stream:stream from='chat.facebook.com' id='1' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'/>
RECEIVED:
    <stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features>
FEATURES: received
PROCESSING:
    <stream:features xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features> (REXML::Element)
TRYING stanzacbs...
TRYING message/iq/presence/cbs...
SENDING:
    <iq id='1192' type='set' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>
RECEIVED:
    <iq from='chat.facebook.com' id='1192' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>-100006248070281@chat.facebook.com/oRbc4KeQ</jid></bind></iq>
SENDING:
    <iq id='2614' type='set' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
RECEIVED:
    <iq from='chat.facebook.com' id='2614' type='result'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
SENDING:
    <message to='-1552527098@chat.facebook.com' xmlns='jabber:client'><body>    Hi, friend! 2013-09-11 17:46:10 +0300
    </body></message>
SENDING:
    </stream:stream>

调试模式已启用。
警告模式已启用。
解决:
_xmpp客户端。\u tcp.chat.facebook.com(SRV)
连接:
chat.facebook.com:5222
“套接字:”
“本地地址:[\'AF\u INET\'、39123、\'172.27.*\'、\'172.27.*\'”
“线程列表大小:1”
#<TCPSocket:fd 11>
发送:
收到:
收到:
X-FACEBOOK-PLATFORMPLAIN
特点:收到
处理:
X-FACEBOOK-PLATFORMPLAIN(REXML::Element)
特点:等待。。。
正在尝试第节。。。
特点:等待完成
正在尝试消息/iq/presence/cbs。。。
发送:
收到:
TLSv1:正在进行OpenSSL握手
TLSv1:重新启动语法分析器
“套接字:”
“本地地址:[\'AF\u INET\'、39123、\'172.27.*\'、\'172.27.*\'”
“线程列表大小:1”
#
发送:
收到:
收到:
X-FACEBOOK-PLATFORMPLAIN
特点:等待。。。
特点:收到
处理:
X-FACEBOOK-PLATFORMPLAIN(REXML::Element)
正在尝试第节。。。
特点:等待完成
正在尝试消息/iq/presence/cbs。。。
发送:
收到:
dmVyc2lvbj0x。。。
SASL文摘-MD5挑战:
version=1&method=auth.xmpp\u login&nonce=E547D1842。。。
{“version”=>“1”,“method”=>“auth.xmpp_login”,“nonce”=>“E547D1842…”
发送:
YXBpX2。。。
收到:
“套接字:”
“本地地址:[\'AF\u INET\'、39123、\'172.27.*\'、\'172.27.*\'”
“线程列表大小:2”
#
发送:
收到:
收到:
特点:收到
处理:
(REXML::元素)
正在尝试第节。。。
正在尝试消息/iq/presence/cbs。。。
发送:
收到:
-100006248070281@chat.facebook.com/oRbc4KeQ
发送:
收到:
发送:
嗨,朋友!2013-09-11 17:46:10 +0300
发送:

问题从何而来?是FB bug、gem bug还是其他什么?

好吧,这听起来很疯狂。。。而且是

我遇到了这个问题(代码将聊天信息发送给收件人列表),在这两天的大部分时间里,我的头撞在墙上,像OP一样挖掘XMPP流量。我还发现,收到的数据在成功和失败之间是不变的。FB只是高兴地吞下了它,什么也没送。非常令人沮丧

我的耐心快到尽头了,并且即将决定我们必须完全重新设计该功能(放弃FB聊天),我在黑暗中尝试了一次尝试,似乎成功了

我引入了一个人工延迟(1秒),在给客户端发送的调用之间


非常神秘的是,这似乎解决了它。我需要对它进行更多的测试,但到目前为止,100%的消息都是在这种延迟下发送的。对于我刚刚提交的代码,我没有任何合理的理由,但它似乎是有效的。我要了

划伤那个。。。2 secondsYep,我的一位同事花了几天的时间,结果又耽搁了一秒钟。这似乎是可行的,尽管我怀疑它不适用于某些边缘情况,例如,当网络延迟大于延迟时。是的,@DimitarBonev说的。。。延迟会更好,但仍然不够可靠。我最终放弃了这项功能,并重新设计了它,不再使用FB聊天。哦,另一个促成这一决定的因素是FB完全放弃了他们的聊天API: