Skip to content

API reference / @chanx-js/client / svelte / TopicStore

Interface: TopicStore<T> ​

Defined in: packages/client/src/svelte/index.ts:181

Extends ​

Type Parameters ​

Type Parameter
T extends TopicRef

Properties ​

clearMessages ​

ts
clearMessages: () => void;

Defined in: packages/client/src/svelte/index.ts:188

Returns ​

void


close ​

ts
close: () => void;

Defined in: packages/client/src/svelte/index.ts:189

Returns ​

void


getHandle ​

ts
getHandle: () => 
  | TopicHandle<ToServerOf<T>, ToClientOf<T>>
  | null;

Defined in: packages/client/src/svelte/index.ts:187

The topic's handle while joined.

Returns ​

| TopicHandle<ToServerOf<T>, ToClientOf<T>> | null


request ​

ts
request: (message, options?) => Promise<ChanxMessage>;

Defined in: packages/client/src/svelte/index.ts:185

Send on the topic and wait for the reply carrying the same ref.

Parameters ​

ParameterType
messageToServerOf<T>
options?RequestOptions

Returns ​

Promise<ChanxMessage>


send ​

ts
send: (message) => void;

Defined in: packages/client/src/svelte/index.ts:183

Send on the topic.

Parameters ​

ParameterType
messageToServerOf<T>

Returns ​

void


terminate ​

ts
terminate: (code?, reason?) => void;

Defined in: packages/client/src/svelte/index.ts:191

Close the socket for every consumer sharing it.

Parameters ​

ParameterType
code?number
reason?string

Returns ​

void

Methods ​

subscribe() ​

ts
subscribe(
   this, 
   run, 
   invalidate?
): Unsubscriber;

Defined in: node_modules/.pnpm/svelte@5.57.1_@typescript-eslint+types@8.70.0/node_modules/svelte/types/index.d.ts:2769

Subscribe on value changes.

Parameters ​

ParameterTypeDescription
thisvoid-
runSubscriber<TopicSnapshot<T>>subscription callback
invalidate?() => voidcleanup callback

Returns ​

Unsubscriber

Inherited from ​

ts
Readable.subscribe

MIT licensed