Sha256: fdf16d6d2acef81efa13ae0db829812e56316ff8df35e4222b6ca8f3e429b15b

Contents?: true

Size: 587 Bytes

Versions: 3

Compression:

Stored size: 587 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

3 entries across 3 versions & 1 rubygems

Version Path
websocket-client-simple-0.9.0 test/test_connect_block.rb
websocket-client-simple-0.8.0 test/test_connect_block.rb
websocket-client-simple-0.7.0 test/test_connect_block.rb