The JavaScript SDK is in pre-release and not on npm yet. Install it from source.
FolkwaysDocs

Signals

Send fire-and-forget signals such as typing indicators and live cursors, and show who is active right now.

A signal is a short-lived "I'm doing this right now": typing, viewing, moving a cursor. Signals are not stored or acknowledged. The node keeps each sender's latest signal for 5 seconds, so a new subscriber sees who is active.

The topic's rule in the dashboard must have the class Ephemeral.

Send one

const typing = client.topic('typing/lobby');

typing.publish('typing', { on: true }, { delivery: 'signal' });

There is nothing to await: the promise resolves once the signal is written, or immediately if it was dropped. Signals are dropped while the client is offline and never retried. Send them at most every couple of seconds, for example on the first keystroke and then every 2 seconds while the user types.

Show who is active

Subscribe, then read topic.values(event): a live map from each sender to their latest signal. Signals older than 5 seconds drop out of it on their own.

typing.subscribe();

const typists = typing.values('typing');
typists.subscribe(() => {
  const names = [...typists.values()]
    .filter((msg) => msg.publisher !== client.session?.identity)
    .map((msg) => msg.publisher);
  showTyping(names); // e.g. "user:7 is typing…"
});

Signals or kv?

Use a signal whenUse kv when
The information is only useful for a few secondsIt should stay until it changes
Losing one is fineEvery change matters
Typing, "is viewing", live cursorsLocations, status, read receipts

Permissions

Sending needs the signal or publish operation in the token, and the rule must allow signal. Anonymous connections can't send signals.

On this page