Sha256: 86797a5fc61fd57214fe11f93eb52f16a9e41cff8fc9dfee7410c0d914db7fba

Contents?: true

Size: 468 Bytes

Versions: 14

Compression:

Stored size: 468 Bytes

Contents

require "rubygems"
require "eventmachine"

module Client
  def receive_data data
    @tokenizer.extract(data).each do |b_data|
      client_data = b_data
      p "Client has sent #{client_data}"
    end
  end

  def start_push_on_client
    send_data("Hello World : #{Time.now}\n")
  end

  def post_init
    @tokenizer = BufferedTokenizer.new
    EM::add_periodic_timer(1) { start_push_on_client }
  end
end

EM.run do
  EM.start_server("localhost",11009,Client)
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
packet-0.1.1 examples/persistent_print.rb
packet-0.1.10 examples/persistent_print.rb
packet-0.1.11 examples/persistent_print.rb
packet-0.1.12 examples/persistent_print.rb
packet-0.1.13 examples/persistent_print.rb
packet-0.1.14 examples/persistent_print.rb
packet-0.1.15 examples/persistent_print.rb
packet-0.1.2 examples/persistent_print.rb
packet-0.1.3 examples/persistent_print.rb
packet-0.1.4 examples/persistent_print.rb
packet-0.1.5 examples/persistent_print.rb
packet-0.1.7 examples/persistent_print.rb
packet-0.1.8 examples/persistent_print.rb
packet-0.1.9 examples/persistent_print.rb