stevegraham/slanger — Issue #14: Slanger crashes when bind event
Author: dgoujard
Created: 2012-01-27 09:22:50+00:00
State: open

Hello,

I have try this sample app : https://github.com/pusher/pusher-presence-demo with slanger. I have ruby 1.9.3 p-0 and when i typing a message Slanger crash :

```ruby
.d8888b. 888
d88P Y88b 888
Y88b. 888
"Y888b. 888 8888b. 88888b. .d88b. .d88b. 888d888
"Y88b. 888 "88b 888 "88b d88P"88b d8P Y8b 888P"
"888 888 .d888888 888 888 888 888 88888888 888
Y88b d88P 888 888 888 888 888 Y88b 888 Y8b. 888
"Y8888P" 888 "Y888888 888 888 "Y88888 "Y8888 888
888
Y8b d88P
"Y88P"

Slanger API server listening on port 4567
Slanger WebSocket server listening on port 8080
[[:initialize]]

[[:receive_data,
"GET /app/765ec374ae0a69f4ce44?client=js&version=1.8.6 HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: localhost:8080\r\nOrigin: http://0.0.0.0:3000\r\nSec-WebSocket-Key: wCISRqhsthuGigD8VgvOCA==\r\nSec-WebSocket-Version: 13\r\n\r\n"]]

[[:inbound_headers,
"GET /app/765ec374ae0a69f4ce44?client=js&version=1.8.6 HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: localhost:8080\r\nOrigin: http://0.0.0.0:3000\r\nSec-WebSocket-Key: wCISRqhsthuGigD8VgvOCA==\r\nSec-WebSocket-Version: 13\r\n\r\n"]]

[[:upgrade_headers,
["HTTP/1.1 101 Switching Protocols",
"Upgrade: websocket",
"Connection: Upgrade",
"Sec-WebSocket-Accept: Pk1HyM8rbmjzwAp6wVeVoKZRNfE="]]]

[[:sending_frame,
:text,
"{\"channel\":null,\"event\":\"pusher:connection_established\",\"data\":{\"socket_id\":\"a0c7d46f-ac3b-4c55-94e4-aad93744b1ba\"}}"]]

[[:receive_data,
"\x81\xFE\x01C\x84\xB8V\xCC\xFF\x9A3\xBA\xE1\xD6\"\xEE\xBE\x9A&\xB9\xF7\xD03\xBE\xBE\x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"channel\":\"presence-demo\",\"auth\":\"765ec374ae0a69f4ce44:5d1958a2b3939afe521eced1ae8d827368511f0c8c62eafece2231b6c58df044\",\"channel_data\":\"{\\\"user_id\\\":\\\"f381d8607bebda627e089ab854a607a8\\\",\\\"user_info\\\":{\\\"gravatar\\\":\\\"http://www.gravatar.com/avatar/476fb3f39354f7c6fe98330d0930f577\\\"}}\"}}"]]

[[:sending_frame,
:text,
"{\"channel\":\"presence-demo\",\"event\":\"pusher_internal:subscription_succeeded\",\"data\":{\"presence\":{\"count\":1,\"ids\":[\"f381d8607bebda627e089ab854a607a8\"],\"hash\":{\"f381d8607bebda627e089ab854a607a8\":{\"gravatar\":\"http://www.gravatar.com/avatar/476fb3f39354f7c6fe98330d0930f577\"}}}}}"]]

[[:receive_data,
"\x81\xE9\x18A\xE0acc\x85\x17}/\x94C\"c\x83\rq$\x8E\x1555\x99\x11q/\x87C4c\x84\x00l \xC2[cc\x95\x12}3\xBF\b|c\xDAC~r\xD8P|y\xD6Q/#\x85\x03| \xD6S/$\xD0Y! \x82Y-u\x81W(v\x81Y:<\xCCC{)\x81\x0Fv$\x8CC\"c\x90\x13}2\x85\x0F{$\xCD\x05},\x8FCe"]]

[[:message_received,
:text,
"{\"event\":\"client-typing\",\"data\":{\"user_id\":\"f381d8607bebda627e089ab854a607a8\"},\"channel\":\"presence-demo\"}"]]

[[:error,
#>]]

[[:unbind, :connection]]

/Users/damien/.rvm/gems/ruby-1.9.3-head/gems/slanger-0.1.1/lib/slanger/handler.rb:17:in `onmessage': undefined method `client-typing' for # (NoMethodError)
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/slanger-0.1.1/lib/slanger/web_socket_server.rb:13:in `block (3 levels) in run'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/em-websocket-0.3.6/lib/em-websocket/connection.rb:17:in `call'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/em-websocket-0.3.6/lib/em-websocket/connection.rb:17:in `trigger_on_message'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/em-websocket-0.3.6/lib/em-websocket/message_processor_06.rb:45:in `message'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/em-websocket-0.3.6/lib/em-websocket/framing07.rb:102:in `process_data'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/em-websocket-0.3.6/lib/em-websocket/handler.rb:28:in `receive_data'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/em-websocket-0.3.6/lib/em-websocket/connection.rb:69:in `receive_data'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/gems/slanger-0.1.1/bin/slanger:46:in `'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/bin/slanger:19:in `load'
from /Users/damien/.rvm/gems/ruby-1.9.3-head/bin/slanger:19:in `

'
```