Hello everyone,

I just started to learn Ruby. As a learning-by-doing project I chose
something with websockets. Maybe a bit ambitious, as I only did some
Perl many years ago and had C beginners courses in university..
Anyway, I can be quite stubborn!

I successfully connect to a websocket server and can receive its output.
However, trying to send it strings (for the handshake) fails.

Stripped-down source:

##################

EventMachine.run {
  http = EventMachine::HttpRequest.new("ws://websocketstest.com").get
:timeout => 0

  http.errback { puts "oops" }
  http.callback   {
    puts "WebSocket connected!"

    http.send("asdfg")
}

##################

Output:
websocket.rb:16:in `send': undefined method `asdfg' for
#<EventMachine::HttpClient:0x7f8fb3cc4490> (NoMethodError)

##################

This code is posted in several places as an example for using
websockets.
Included ruby gems: 'rubygems' 'eventmachine' 'em-http-request'
'em-http'
"http.send" seems to be recognized and called, I am totally lost why it
doesnt transfer the string "asdfg" to "http.send".


I am grateful for any hints. Also if etiquette would suggest me to post
or format differently.

Thank you,

Manuel

-- 
Posted via http://www.ruby-forum.com/.