Storage

A simple API, very similar to the localStorage API that can be used to persist strings or complex serialized data.

This storage is persisted, does not expire, and is not limited to the scope of a single user :

// user A
await Storage.setItem('test', 'hello')


// user B
console.log(await Storage.getItem('test'))
// => hello

use cases : games, polls, sharing media, collaboration tools, private notes, anything that requires retrieving data after a refresh or when new participants enter the room.

setItem()

Store a value under a specific key. This storage is persistent and shared across participants of the event.

usage :

await Storage.setItem('key', 'value')
ParamType Description
keystringThe key that will allow you to retrieve the value
valuestringThe value you want to store
{ scope: string }[event/session/organization]Change the scope of the storage

@returns a promise that resolves whenever the value has been successfully stored

getItem()

Retrieve a value set at a specific key. This storage is persistent and shared across participants of the event.

usage :

await Storage.getItem('key')
ParamType Description
keystringThe key at which your item is set
{ scope: string }[event/session/organization]Change the scope of the storage

@returns a promise that resolves with the stored value


Did this page help you?