Skip to content
v2.7

Presences

Realtime presence: who is connected and where.

Realtime presence: who is connected and where.

Class Presences: 5 methods (5 in @owbase/web, 5 in @owbase/node). The examples use the object form of the parameters; replace the values between < and > with your own.

List presences

GET /presences · method page

SDK: @owbase/web and @owbase/node

List presence logs. Expired entries are filtered out automatically.

Parameter Type Required Description
queries string[] no Array of query strings generated using the Query class provided by the SDK.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.
ttl number no TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours).

Access: API key with the presences.read scope or user session (the resource’s permissions apply).

@owbase/web
import { Client, Presences } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const presences = new Presences(client);
const result = await presences.list({
queries: [], // optional
total: false, // optional
ttl: 0, // optional
});
console.log(result);
@owbase/node
import { Client, Presences } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const presences = new Presences(client);
const result = await presences.list({
queries: [], // optional
total: false, // optional
ttl: 0, // optional
});

Get presence

GET /presences/{presenceId} · method page

SDK: @owbase/web and @owbase/node

Get a presence log by its unique ID. Entries whose expiresAt is in the past are treated as not found.

Parameter Type Required Description
presenceId string yes Presence unique ID.

Access: API key with the presences.read scope or user session (the resource’s permissions apply).

@owbase/web
import { Client, Presences } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const presences = new Presences(client);
const result = await presences.get({
presenceId: '<PRESENCE_ID>',
});
console.log(result);
@owbase/node
import { Client, Presences } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const presences = new Presences(client);
const result = await presences.get({
presenceId: '<PRESENCE_ID>',
});

Upsert presence

PUT /presences/{presenceId} · method page

SDK: @owbase/web and @owbase/node

Create or update a presence log by its user ID.

Parameters in @owbase/web:

Parameter Type Required Description
presenceId string yes Presence unique ID.
status string yes Presence status.
permissions string[] no An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
expiresAt string no Presence expiry datetime.
metadata object no Presence metadata object.

Parameters in @owbase/node:

Parameter Type Required Description
presenceId string yes Presence unique ID.
userId string yes User ID.
status string yes Presence status.
permissions string[] no An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
expiresAt string no Presence expiry datetime.
metadata object no Presence metadata object.

Access: user session (the resource’s permissions apply).

@owbase/web
import { Client, Presences, Permission, Role } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const presences = new Presences(client);
const result = await presences.upsert({
presenceId: '<PRESENCE_ID>',
status: '<STATUS>',
permissions: [Permission.read(Role.any())], // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
});
console.log(result);
@owbase/node
import { Client, Presences, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const presences = new Presences(client);
const result = await presences.upsert({
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>',
permissions: [Permission.read(Role.any())], // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
});

Update presence

PATCH /presences/{presenceId} · method page

SDK: @owbase/web and @owbase/node

Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated.

Parameters in @owbase/web:

Parameter Type Required Description
presenceId string yes Presence unique ID.
status string no Presence status.
expiresAt string no Presence expiry datetime.
metadata object no Presence metadata object.
permissions string[] no An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
purge boolean no When true, purge cached responses used by list presences endpoint.

Parameters in @owbase/node:

Parameter Type Required Description
presenceId string yes Presence unique ID.
userId string yes User ID.
status string no Presence status.
expiresAt string no Presence expiry datetime.
metadata object no Presence metadata object.
permissions string[] no An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
purge boolean no When true, purge cached responses used by list presences endpoint.

Access: user session (the resource’s permissions apply).

@owbase/web
import { Client, Presences, Permission, Role } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const presences = new Presences(client);
const result = await presences.update({
presenceId: '<PRESENCE_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
permissions: [Permission.read(Role.any())], // optional
purge: false, // optional
});
console.log(result);
@owbase/node
import { Client, Presences, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const presences = new Presences(client);
const result = await presences.update({
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
permissions: [Permission.read(Role.any())], // optional
purge: false, // optional
});

Delete presence

DELETE /presences/{presenceId} · method page

SDK: @owbase/web and @owbase/node

Delete a presence log by its unique ID.

Parameter Type Required Description
presenceId string yes Presence unique ID.

Access: API key with the presences.write scope or user session (the resource’s permissions apply).

@owbase/web
import { Client, Presences } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const presences = new Presences(client);
const result = await presences.delete({
presenceId: '<PRESENCE_ID>',
});
console.log(result);
@owbase/node
import { Client, Presences } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const presences = new Presences(client);
const result = await presences.delete({
presenceId: '<PRESENCE_ID>',
});

The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.

Was this page helpful?