Sha256: 12d1e2ba7b6fe88b0c21acd01f6ddd9438b7d834dbb0c568083138798a412457

Contents?: true

Size: 605 Bytes

Versions: 7

Compression:

Stored size: 605 Bytes

Contents

require File.expand_path 'test_helper', File.dirname(__FILE__)

class TestWebSocketClientSimple < MiniTest::Test
  
  def test_onopen
    
    EM::run{
      
      EchoServer.start

      res = nil

      EM::add_timer 1 do
        WebSocket::Client::Simple.connect EchoServer.url do |client|
          client.on :open do
            client.send "hello world"
          end

          client.on :message do |msg|
            res = msg.to_s
          end
        end
      end

      EM::add_timer 2 do
        assert_equal res, "hello world"
        EM::stop_event_loop
      end
    }
    
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
websocket-client-simple-0.6.1 test/test_connect_block.rb
websocket-client-simple-0.6.0 test/test_connect_block.rb
websocket-client-simple-0.5.1 test/test_connect_block.rb
websocket-client-simple-0.5.0 test/test_connect_block.rb
websocket-client-simple-0.4.0 test/test_connect_block.rb
websocket-client-simple-0.3.1 test/test_connect_block.rb
websocket-client-simple-0.3.0 test/test_connect_block.rb