lib/plezi/handlers/controller_magic.rb in plezi-0.8.2 vs lib/plezi/handlers/controller_magic.rb in plezi-0.8.3

- old
+ new

@@ -50,9 +50,18 @@ # checks whether this instance accepts broadcasts (WebSocket instances). def accepts_broadcast? @_accepts_broadcast end + # sets the controller to refuse "broadcasts". + # + # This allows some websocket connections to isolate themselves even before they are fully disconnected. + # + # call this method once it is clear the websocket connection should be terminated. + def refuse_broadcasts + @_accepts_broadcast = false + self + end # this method does two things. # # 1. sets redirection headers for the response. # 2. sets the `flash` object (short-time cookies) with all the values passed except the :status value.