README.md in ratchetio-0.4.7 vs README.md in ratchetio-0.4.8

- old
+ new

@@ -83,16 +83,51 @@ ``` ## Exception level filters -By default, all exceptions reported through `Ratchetio.report_exception()` are reporeted at the "error" level, except for the following, which are reported at "warning" level: +By default, all exceptions reported through `Ratchetio.report_exception()` are reported at the "error" level, except for the following, which are reported at "warning" level: - ActiveRecord::RecordNotFound - AbstractController::ActionNotFound - ActionController::RoutingError If you'd like to customize this list, see the example code in `config/initializers/ratchetio.rb`. Supported levels: "critical", "error", "warning", "info", "debug", "ignore". Set to "ignore" to cause the exception not to be reported at all. + + + +## Asynchronous reporting + +By default, all messages are reported synchronously. You can enable asynchronous reporting by adding the following in `config/initializers/ratchetio.rb`: + +```ruby + config.use_async = true +``` + +Ratchet uses [girl_friday](https://github.com/mperham/girl_friday) to handle asynchronous reporting when installed, and falls back to Threading if girl_friday is not installed. + +You can supply your own handler using `config.async_handler`. The handler should schedule the payload for later processing (i.e. with a delayed_job, in a resque queue, etc.) and should itself return immediately. For example: + +```ruby + config.async_handler = Proc.new { |payload| + Thread.new { Ratchetio.process_payload(payload) } + } +``` + +Make sure you pass `payload` to `Ratchetio.process_payload` in your own implementation. + + +## Using with ratchet-agent + +For even more asynchrony, you can configure the gem to write to a file instead of sending the payload to Ratchet servers directly. [ratchet-agent](https://github.com/ratchetio/ratchet-agent) can then be hooked up to this file to actually send the payload across. To enable, add the following in `config/initializers/ratchetio.rb`: + +```ruby + config.write_to_file = true + # optional, defaults to "#{AppName}.ratchet" + config.filepath = '/path/to/file.ratchet' #should end in '.ratchet' for use with ratchet-agent +``` + +For this to work, you'll also need to set up ratchet-agent--see its docs for details. ## Help / Support If you run into any issues, please email us at `support@ratchet.io`