Skip to Content
LYNKORIADocs
SDK reference

React SDK reference

Exports of @lynkoria/react 0.1.0, generated from its type declarations.

Package @lynkoria/react, version 0.1.0. React 18.2 or 19 client components (in the Next.js App Router, inside a "use client" boundary).

Generated from the package's bundled type declarations; every signature below is what your editor sees. For how to use it, read the guide.

Functions

applyEvent

Pure merge of a conversation event into a seq-ordered message list (edits/deletes replace by id).

function applyEvent(messages: readonly Message[], event: ConversationEvent): Message[];

LynkoriaProvider

Connects the client while mounted. Disconnecting is deferred by one task, so Strict Mode's effect replay (and remounts in the same tick) keep the existing socket instead of reconnecting.

function LynkoriaProvider({ client, children }: {
  client: LynkoriaClient;
  children: ReactNode;
}): ReactNode;

mergeHistory

function mergeHistory(messages: readonly Message[], older: readonly Message[]): Message[];

useCall

Joins a call through the client SDK's media adapter; leaves on unmount. Render with session.room.

function useCall(): CallState;

useCallParticipants

Live participant list (joins, leaves, mute/camera/screen, speaking, connection quality).

function useCallParticipants(session: CallSession | null): CallParticipant[];

useConnectionState

function useConnectionState(): ConnectionState;

useConversation

Live, ordered message list for one conversation: history + realtime events + gap resync.

function useConversation(conversationId: string): ConversationState;

useLynkoria

function useLynkoria(): LynkoriaClient;

usePresence

function usePresence(userId: string | null | undefined): Presence | null;

useTyping

User ids currently typing in a conversation (entries expire after 6 s without a refresh).

function useTyping(conversationId: string): string[];

Types

CallState

type CallState = {
  session: CallSession | null;
  state: CallConnectionState | 'idle';
  error: Error | null;
  join: (options: JoinCallOptions) => Promise<CallSession>;
  leave: () => Promise<void>;
};

ConversationState

type ConversationState = {
  messages: Message[];
  loading: boolean;
  error: LynkoriaError | null;
  hasMore: boolean;
  loadOlder: () => Promise<void>;
  send: (text: string, options?: {
    attachmentIds?: string[];
    parentMessageId?: string;
  }) => Promise<Message>;
  markRead: () => Promise<void>;
};

On this page