Skip to content

Commit

Permalink
Adding a bit of documentation for the .on_no_data callback
Browse files Browse the repository at this point in the history
  • Loading branch information
rud committed May 11, 2012
1 parent 6650484 commit b850806
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ JSON format only.
stream.on_max_reconnects do |timeout, retries|
# Something is wrong on your side. Send yourself an email.
end

stream.on_no_data do
# Twitter has stopped sending any data on the currently active
# connection, reconnecting is probably in order
end
}


Expand Down
2 changes: 2 additions & 0 deletions lib/twitter/json_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def on_reconnect &block
@reconnect_callback = block
end

# Called when no data has been received for NO_DATA_TIMEOUT seconds.
# Reconnecting is probably in order as per the Twitter recommendations
def on_no_data &block
@no_data_callback = block
end
Expand Down

0 comments on commit b850806

Please sign in to comment.