这是相当奇怪的,因为它曾经工作,现在它不能。如果是"未授权"错误,那就很容易了,但是对于"IOError: closed stream",我就难倒了。
我认为这可能是由于过期的令牌,但访问令牌得到更新每当用户登录与Facebook。
由于遇到错误,我一步一步地尝试,发现它发生在调用auth_sasl方法时。
1.9.3p194 :073 > c = Jabber::Client.new(Jabber::JID.new("-[FB_ID]@chat.facebook.com"))
[output omitted]
1.9.3p194 :074 > c.connect
[output omitted]
1.9.3p194 :079 > c.is_connected?
=> true
1.9.3p194 :080 > c.auth_sasl(Jabber::SASL::XFacebookPlatform.new(c, [FB_KEY], [TOKEN], [FB_SECRET]), nil)
IOError: closed stream
from /Users/yangtheman/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:318:in `syswrite'
from /Users/yangtheman/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:318:in `do_write'
from /Users/yangtheman/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:383:in `<<'
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:346:in `block in send_data'
from <internal:prelude>:10:in `synchronize'
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in `send_data'
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:378:in `send'
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/xmpp4r_facebook-0.1.1/lib/xmpp4r_facebook.rb:11:in `initialize'
from (irb):80:in `new'
from (irb):80
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
1.9.3p194 :081 > c.is_connected?
=> false
谁能解释一下为什么会发生这种情况?还有其他人有相同或类似的问题吗?
EDIT:我打开了调试,下面是我收到的"错误"消息。似乎很多人都有同样的问题,但我找不到任何解决方案或解释这个问题。大:(。
<subject>Sorry, your account isn't available</subject><body>Your account is temporarily unavailable. Regain access by logging into your account from a web browser.</body></message>
任何帮助将非常感激!
谢谢,
在多个操作系统上都遇到了同样的问题;客户端- 肯定是服务器端问题,但没有得到FB的任何回应。问题开始出现在我在FB中启用2FA后-不确定这是否是根本原因。聊天很重要,但FB提供的小"安全"更重要。