pusher-client rubygem 在订阅公共频道时工作正常,但是当我尝试订阅 Presence 或 Private Channel 时,它会抛出“ArgumentError:错误数量的参数(2 比 1)”。这会发生在其他人身上吗?
module PusherClientTest
require 'pusher-client'
PusherClient.logger = Logger.new(STDOUT)
options = { :secret => '12345' }
socket = PusherClient::Socket.new("54321", options)
USER_ID = 1
socket.subscribe('presence-TestChannel', USER_ID)
socket.bind('remark') do |data|
puts data
end
socket.connect
end
结果是:
ree-1.8.7-2010.02 > PusherClientTest
ArgumentError: wrong number of arguments (2 for 1)
from /Users/Dev/Sites/test_app/app/models/pusher_client_test.rb:16:in `subscribe'
from /Users/Dev/Sites/test_app/app/models/pusher_client_test.rb:16
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:406:in `load_without_new_constant_marking'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:406:in `load_file'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:405:in `load_file'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:285:in `require_or_load'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:451:in `load_missing_constant'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:106:in `const_missing_not_from_s3_library'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
from /Users/Dev/.rvm/gems/ree-1.8.7-2010.02@test_app/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:118:in `const_missing'
from (irb):1