Open kethomassen opened 8 years ago
Sorry about that, would you have an example to work with? What version of Padrino are you using? Thanks
@dariocravero Hmmm, weird. They have decided to randomly start working again, however now when I try to broadcast I get an error.
DEBUG - {"some"=>"data"}
DEBUG - Broadcasting message on channel: ping. Message:
DEBUG - {:pong=>true, :data=>{"some"=>"data"}}
ERROR - Error while running the event handler
ERROR - undefined method `each' for nil:NilClass
ERROR - /Users/kristianthomassen/.rvm/gems/ruby-2.2.3/gems/padrino-websockets-0.1.1/lib/padrino-websockets/base-event-manager.rb:138:in `broadcast'
/Users/kristianthomassen/.rvm/gems/ruby-2.2.3/gems/padrino-websockets-0.1.1/lib/padrino-websockets/faye/helpers.rb:10:in `broadcast'
/Users/kristianthomassen/Desktop/SkinNetwork.xyz/Skinpot/site/app/app.rb:148:in `block (2 levels) in <class:Skinpot>'
/Users/kristianthomassen/.rvm/gems/ruby-2.2.3/gems/padrino-websockets-0.1.1/lib/padrino-websockets/base-event-manager.rb:95:in `instance_exec'
/Users/kristianthomassen/.rvm/gems/ruby-2.2.3/gems/padrino-websockets-0.1.1/lib/padrino-websockets/base-event-manager.rb:95:in `on_message'
/Users/kristianthomassen/.rvm/gems/ruby-2.2.3/gems/padrino-websockets-0.1.1/lib/padrino-websockets/faye/event-manager.rb:10:in `block in initialize'
using only this now and still getting the error
websocket :channel do
on :ping do |message|
broadcast(:ping, {pong: true, data: message })
end
end
seems to be something to do with the @@connections
variable in base-event-manager.rb
websocket :channel do
on :ping do |message|
send_message(:ping, session['websocket_user'], {pong: true, data: message})
broadcast(:ping, {pong: true, data: message, broadcast: true})
end
end
should actually be
websocket :channel do
on :ping do |message|
send_message(:channel, session['websocket_user'], {pong: true, data: message})
broadcast(:channel, {pong: true, data: message, broadcast: true})
end
end
The example is just a bit wrong
replace :ping with :channel except for on :ping which is essentially on event...
Currently calling any padrino helper functions, e.g.
logged_in?
orcurrent_account
throws a method not found error. Is there any way to bypass or fix this problem?