Skip to content

API reference / @chanx-js/client / vue / useChannel

Function: useChannel() ​

ts
function useChannel<D>(descriptor, options?): UseChannelResult<ToServerOf<D>, ToClientOf<D>>;

Defined in: packages/client/src/vue/index.ts:132

Open (or join) a channel for the lifetime of the current effect scope.

Inside a component it connects on mount and releases on unmount. Outside one it connects at once; call the returned close(). params and queryParams may be refs: a change reconnects.

Type Parameters ​

Type Parameter
D extends ChannelDescriptor<any, any, any, any>

Parameters ​

ParameterType
descriptorD
optionsOmit<ControllerOptions<AddressOf<D>, ToClientOf<D>>, "params" | "queryParams"> & ReactiveConnectOptions

Returns ​

UseChannelResult<ToServerOf<D>, ToClientOf<D>>

MIT licensed