Permalink
Browse files

Add on_connect callback

  • Loading branch information...
1 parent 351704a commit 8c6fc3920f02198d9b3859ce2dce45b0ace46442 @mloughran mloughran committed Sep 9, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/em-jack/connection.rb
@@ -246,6 +246,7 @@ def connected
@reconnect_proc = nil
@retries = 0
succeed
+ @connected_callback.call if @connected_callback
end
def disconnected
@@ -316,6 +317,10 @@ def on_disconnect(&blk)
@disconnected_callback = blk
end
+ def on_connect(&blk)
+ @connected_callback = blk
+ end
+
def received(data)
@data << data

0 comments on commit 8c6fc39

Please sign in to comment.