---
name: "Jifty::Subs"
section: "3pm"
platform: "linux"
package: "libjifty-perl"
version: "1.10518+dfsg-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/Jifty::Subs"
---

# Jifty::Subs(3pm)

Configure subscriptions for the current window or session

## NAME

Jifty::Subs - Configure subscriptions for the current window or session

## SYNOPSIS

```
 my $sid = Jifty->subs->add(
    class       => 'Tick',
    queries     => [{ like => '9' }],
    mode        => 'Replace',
    region      => "clock-time",
    render_with => '/fragments/time',
 );
 Jifty->subs->cancel($sid);
 my @sids = Jifty->subs->list;
```

## DESCRIPTION

## METHODS

### add PARAMHASH

Add a subscription for the current window or session.

Takes the following parameters

- class

  What class of object shall we subscribe to notifications on

- queries

  An array of queries to match items of class `"class"` against. The implementation of `"queries"` is dependent on the type of object events are being recorded against

- mode

  How should the fragment sent to the client on matching events be rendered. Valid modes are `"Replace"`, `"Bottom"` and `"Top"`

- region

  The moniker of the region that updates to this subscription should be rendered into

- render\_with

  The path of the fragment used to render items matching this subscription

- effect

  The effect to use when showing the region, if any.

- effect\_args

  Arguments to the effect

- remove\_effect

  The effect to use when removing the old value of the region, if any.

- remove\_effect\_args

  Arguments to the remove effect

- coalesce

  If multiple events would cause the update of the given region with the same `"render_with"` path, merge them and only render the region once, with the latest update.

### cancel CHANNEL\_ID

Cancels session or window's subscription to CHANNEL\_ID

### list \[window/sessionid\]

Returns a lost of channel ids this session or window is subscribed to.

### update\_on PARAMHASH

Like "add", but provides a sane set of defaults for updating the current region, based on inspection of the current region's properties.  `"queries"` is set to the region's arguments, and `"class"` is left unspecified.
