faye / websocket-driver-ruby

WebSocket protocol handler with pluggable I/O
Other
223 stars 43 forks source link

ping and pong callbacks not emitted for Server #68

Closed renatosnrg closed 4 years ago

renatosnrg commented 5 years ago

I noticed that the callbacks for ping and pong are not emitted for Websocket::Driver::Server. For example, these callbacks will never be executed even if the server receives the ping and pong frames:

driver.on(:ping) { |e| puts "on ping: #{event.inspect}" }
driver.on(:pong) { |e| puts "on pong: #{event.inspect}" }

In the Websocket::Driver::Server code there is the following line:

EVENTS = %w[open message error close]

Is there some specific reason to not include ping and pong events?

Websocket::Driver::Client emits the events as expected.

jcoglan commented 4 years ago

Thanks for spotting this, @renatosnrg. It looks like an oversight on my part -- I've just added those events to the EVENTS list -- can you tell me if that fixes the problem?

jcoglan commented 4 years ago

I'm preparing for a release and will be including the above change, so I'm going to close this issue. Please let me know if it persists.