Skip to main content
Version: Next

Type Alias: UseDataChannelResult

UseDataChannelResult = object

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

Properties

dataChannelError

dataChannelError: Error | null

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

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


dataChannelLoading

dataChannelLoading: boolean

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

Whether data channels are being initialized.


dataChannelReady

dataChannelReady: boolean

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

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:92

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:98

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:106

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