Queue Priority

Priority determines the order alerts are presented. Higher priority alerts jump ahead of lower priority ones in the queue.

Priority Scale

Priority ranges from 0 (lowest) to 10 (highest):
RangeTypical Use
0-2Low priority: follows
3-5Normal: subscriptions, gift subs
6-8High: tips, rants
9-10Critical: large donations, raids

Setting Priority by Type

SBCanvas.queue.setPriority('follow', 2);
SBCanvas.queue.setPriority('subscribe', 5);
SBCanvas.queue.setPriority('gift_sub', 6);
SBCanvas.queue.setPriority('tip', 7);
SBCanvas.queue.setPriority('rant', 7);
SBCanvas.queue.setPriority('raid', 9);
SBCanvas.queue.setPriority('host', 4);

Bulk Priority via Config

SBCanvas.queue.setConfig({
  maxSize: 100,
  defaultPriority: 5,
  priorities: {
    follow: 2,
    subscribe: 5,
    gift_sub: 6,
    tip: 7,
    rant: 7,
    raid: 9,
    host: 4
  }
});

Behavior

  • Alerts with equal priority are ordered FIFO (first-in, first-out)
  • When maxSize is reached, the lowest-priority oldest alert is dropped
  • Priority is assigned at enqueue time — changing priority doesn’t reorder existing items
  • Alerts already being presented are not affected by priority changes

Example: Dynamic Priority Based on Amount

SBCanvas.service.register('dynamic-priority', {
  init() {},
  dispose() {},
  onEvent(event, data) {
    if (event === 'activity:tip' && data.amount >= 100) {
      SBCanvas.queue.setPriority('tip', 10);
      SBCanvas.setTimeout(() => {
        SBCanvas.queue.setPriority('tip', 7);
      }, 5000);
    }
  }
});