Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Add examples

  • Loading branch information...
commit 4a53a698ad3a362a082d8696ae412cde988bdf99 1 parent aefba56
@jordansissel authored
Showing with 24 additions and 0 deletions.
  1. 0  { → examples}/example.rb
  2. +24 −0 examples/timers.rb
View
0  example.rb → examples/example.rb
File renamed without changes
View
24 examples/timers.rb
@@ -0,0 +1,24 @@
+require "netty-3.2.4.Final.jar"
+$: << "lib"
+require "netty-eventmachine/em_api.rb"
+
+class Conn < EventMachine::Connection
+ def receive_data(data)
+ p :received => data
+ end
+end
+
+def tputs(*args)
+ p Thread.current, *args
+end
+
+EventMachine.run do
+ #EventMachine.start_server("0.0.0.0", 3333, Conn)
+ tputs "Hello"
+ 1.upto(10) do |i|
+ t = EventMachine::Timer.new(i * 0.1) do
+ tputs "world #{i}"
+ end
+ t.cancel if i % 2 == 0
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.