Store

For AI assistants

All the docs in one text: paste it into an AI chat, then describe the widget you want.

Markdown

Store

The store keeps values for your widgets on Streamed, so they survive a reload and can be shared: a running tally, the last winner of a giveaway, settings a widget saved for itself. It is shared by all custom widgets of your account.

// Save (any JSON value)
SE_API.store.set('tally', { count: 3, last: 'PixelPanda' });

// Read: null when there is nothing under the key
SE_API.store.get('tally').then((value) => {
  const tally = value || { count: 0 };
});
Call Result
SE_API.store.set(key, value) Saves the value, replacing the old one. Resolves when it is saved. Never rejects: a failure is only written to the console.
SE_API.store.get(key) Resolves to the value, or null when there is none or it could not be read.

Values go through JSON: undefined becomes null, and dates, Maps and functions do not survive.

kvstore:update

Every set fires onEventReceived with the listener kvstore:update in every open custom widget of the account, the one that saved it too. The key has the prefix customWidget.:

window.addEventListener('onEventReceived', (obj) => {
  const { listener, event } = obj.detail;
  if (listener === 'kvstore:update' && event.data.key === 'customWidget.tally') {
    showTally(event.data.value);
  }
});
{ "listener": "kvstore:update", "event": { "data": { "key": "customWidget.tally", "value": { "count": 3, "last": "PixelPanda" } } } }

Limits

  • A key has 1-64 letters, digits, _ or -. With any other key, nothing is saved or read, and the call only gives up after 10 seconds (get then resolves to null).
  • A value is at most 64 KB as JSON.
  • At most 100 keys per account.
  • At most 10 writes per 10 seconds from one widget. Write a counter after a change, not on a timer; to save often, wait until changes stop for a moment and save once.

Store or variable?

Store Variable
Who changes it widgets you, on the dashboard; tips
Values any JSON a number or a text
Seen by custom widgets custom widgets, alert texts, the bot

Anyone who knows the link of one of your custom widgets can read and change its store.

Connection lost

Couldn't reach the Streamed server. Either your internet is down, there's maintenance going on in the background, or who knows.. maybe something really is wrong on our end.

Trying again…