Skip to main content
Version: Next

Type Alias: UseDataChannelResult

UseDataChannelResult = object

Defined in: react-client/dist/types/public.d.ts:87

Properties​

dataChannelError​

dataChannelError: Error | null

Defined in: react-client/dist/types/public.d.ts:120

Error that occurred during data publisher operations, or null if no error.


dataChannelLoading​

dataChannelLoading: boolean

Defined in: react-client/dist/types/public.d.ts:116

Whether data channels are being initialized.


dataChannelReady​

dataChannelReady: boolean

Defined in: react-client/dist/types/public.d.ts:112

Whether data channels are connected and ready to send data. Resets to false on disconnect.


initializeDataChannel()​

initializeDataChannel: () => void

Defined in: react-client/dist/types/public.d.ts:93

Initializes the data channel.

Requires that the fishjam client is already connected.

Returns​

void


publishData()​

publishData: (payload, options) => void

Defined in: react-client/dist/types/public.d.ts:99

Sends binary data through a data channel.

Parameters​

ParameterTypeDescription
payloadUint8ArrayThe Uint8Array payload to send (first positional argument)
optionsDataChannelOptionsData channel options; specify reliable: true for guaranteed delivery or reliable: false for low latency

Returns​

void


subscribeData()​

subscribeData: (callback, options) => () => void

Defined in: react-client/dist/types/public.d.ts:107

Subscribe to incoming data on a data channel. Can be called before or after channel creation.

Parameters​

ParameterTypeDescription
callbackDataCallbackFunction called when data is received
optionsDataChannelOptionsSpecify reliable: true or reliable: false to choose channel

Returns​

Unsubscribe function - call to cancel the subscription

(): void

Returns​

void