Skip to main content
Version: 0.29.0

Type Alias: UseDataChannelResult

UseDataChannelResult = object

Defined in: react-client/src/types/public.ts:92

Properties​

dataChannelError​

dataChannelError: Error | null

Defined in: react-client/src/types/public.ts:125

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


dataChannelLoading​

dataChannelLoading: boolean

Defined in: react-client/src/types/public.ts:121

Whether data channels are being initialized.


dataChannelReady​

dataChannelReady: boolean

Defined in: react-client/src/types/public.ts:117

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


initializeDataChannel()​

initializeDataChannel: () => void

Defined in: react-client/src/types/public.ts:98

Initializes the data channel.

Requires that the fishjam client is already connected.

Returns​

void


publishData()​

publishData: (payload, options) => void

Defined in: react-client/src/types/public.ts:104

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/src/types/public.ts:112

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