README.md in wisper-1.2.1 vs README.md in wisper-1.3.0

- old
+ new

@@ -210,10 +210,28 @@ In a Rails app you might want to add your global listeners in an initalizer. Global listeners are threadsafe. +### Scoping to publisher class + +You might want to globally subscribe a listener to publishers with a certain +class. + +```ruby +Wisper.add_listener(MyListener.new, :scope => :MyPublisher) +``` + +This will subscribe the listener to all instances of `MyPublisher` and its +subclasses. + +Alternatively you can also do exactly the same with a publisher class: + +```ruby +MyPublisher.add_listener(MyListener.new) +``` + ## Temporary Global Listeners You can also globally subscribe listeners for the duration of a block. ```ruby @@ -235,9 +253,22 @@ of events to `:on`. ```ruby post_creater.subscribe(PusherListener.new, :on => :create_post_successful) ``` + +## Prefixing broadcast events + +If you would prefer listeners to receive events with a prefix, for example +`on`, you can do so by passing a string or symbol to `:prefix`. + +```ruby +post_creater.subscribe(PusherListener.new, :prefix => :on) +``` + +If `post_creater` where to broadcast the event `post_created` the subscribed +listeners would receive `on_post_created`. You can also pass `true` which will +use the default prefix, "on". ## Mapping an event to a different method By default the method called on the subscriber is the same as the event broadcast. However it can be mapped to a different method using `:with`.