From 4d12ffc2aadc929cf9e97da8f009b90acca79629 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Wed, 28 Jan 2026 12:09:26 +0100 Subject: [PATCH 1/6] add clientType to provider --- packages/mobile-client/src/index.ts | 8 ++++++-- packages/mobile-client/src/useForegroundService.ts | 6 +++--- packages/react-client/src/FishjamProvider.tsx | 10 ++++++++-- packages/ts-client/src/FishjamClient.ts | 5 ++++- packages/ts-client/src/index.ts | 1 + packages/ts-client/src/types.ts | 8 ++++++++ 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index 3a35a753..0f4a1483 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -8,7 +8,7 @@ import React from 'react'; import { FishjamProvider as ReactClientFishjamProvider, type FishjamProviderProps as ReactClientFishjamProviderProps, - useMicrophone as useMicrophoneReactClient + useMicrophone as useMicrophoneReactClient, } from '@fishjam-cloud/react-client'; export { RTCView, RTCPIPView, type RTCVideoViewProps, type RTCPIPViewProps } from './overrides/RTCView'; @@ -41,7 +41,10 @@ export { Variant, } from '@fishjam-cloud/react-client'; -export const useMicrophone = useMicrophoneReactClient as () => Omit< ReturnType, 'toggleMicrophoneMute' > +export const useMicrophone = useMicrophoneReactClient as () => Omit< + ReturnType, + 'toggleMicrophoneMute' +>; export type { UseInitializeDevicesParams, @@ -88,5 +91,6 @@ export function FishjamProvider(props: FishjamProviderProps) { return React.createElement(ReactClientFishjamProvider, { ...props, persistLastDevice: false, + clientType: 'mobile', }); } diff --git a/packages/mobile-client/src/useForegroundService.ts b/packages/mobile-client/src/useForegroundService.ts index d3009c0d..5ee1b093 100644 --- a/packages/mobile-client/src/useForegroundService.ts +++ b/packages/mobile-client/src/useForegroundService.ts @@ -2,7 +2,7 @@ import { useForegroundService as externalUseForegroundService } from '@fishjam-c /** * Configuration options for foreground service permissions. - * + * * A type representing the configuration for foreground service permissions. */ export type ForegroundServiceConfig = { @@ -38,10 +38,10 @@ export type ForegroundServiceConfig = { /** * Hook for managing a foreground service on Android. - * + * * A hook for managing a foreground service on Android. Does nothing on other platforms. * You can use this hook to keep your app running in the background. You're also required to run a foreground service when screen sharing. - * + * * @param config - Configuration options for the foreground service. */ export const useForegroundService = externalUseForegroundService; diff --git a/packages/react-client/src/FishjamProvider.tsx b/packages/react-client/src/FishjamProvider.tsx index 12c837eb..f6dbebec 100644 --- a/packages/react-client/src/FishjamProvider.tsx +++ b/packages/react-client/src/FishjamProvider.tsx @@ -1,4 +1,4 @@ -import { FishjamClient, getLogger, type ReconnectConfig } from "@fishjam-cloud/ts-client"; +import { type ClientType, FishjamClient, getLogger, type ReconnectConfig } from "@fishjam-cloud/ts-client"; import { type PropsWithChildren, useMemo, useRef } from "react"; import { CameraContext } from "./contexts/camera"; @@ -61,6 +61,10 @@ export interface FishjamProviderProps extends PropsWithChildren { * Enables Fishjam SDK's debug logs in the console. */ debug?: boolean; + /** + * Type of client used. + */ + clientType?: ClientType; } /** @@ -68,7 +72,9 @@ export interface FishjamProviderProps extends PropsWithChildren { * @category Components */ export function FishjamProvider(props: FishjamProviderProps) { - const fishjamClientRef = useRef(new FishjamClient({ reconnect: props.reconnect, debug: props.debug })); + const fishjamClientRef = useRef( + new FishjamClient({ reconnect: props.reconnect, debug: props.debug, clientType: props.clientType }), + ); const persistHandlers = useMemo(() => { if (props.persistLastDevice === false) return undefined; diff --git a/packages/ts-client/src/FishjamClient.ts b/packages/ts-client/src/FishjamClient.ts index f3ef5341..bceacba1 100644 --- a/packages/ts-client/src/FishjamClient.ts +++ b/packages/ts-client/src/FishjamClient.ts @@ -20,6 +20,7 @@ import { isComponent, isJoinError, isPeer } from './guards'; import { MessageQueue } from './messageQueue'; import { ReconnectManager } from './reconnection'; import type { + ClientType, Component, ConnectConfig, CreateConfig, @@ -77,6 +78,7 @@ export class FishjamClient void) | null = null; private debug: boolean; private logger: ReturnType; + private clientType: ClientType; public status: 'new' | 'initialized' = 'new'; @@ -93,6 +95,7 @@ export class FishjamClient( this, @@ -166,7 +169,7 @@ export class FishjamClient { this.emit('socketOpen', event); - const sdkVersion = `web-${packageVersion}`; + const sdkVersion = `${this.clientType}-${packageVersion}`; const message = PeerMessage.encode({ authRequest: { token, sdkVersion } }).finish(); this.websocket?.send(message); }; diff --git a/packages/ts-client/src/index.ts b/packages/ts-client/src/index.ts index bc099038..bb7b46b9 100644 --- a/packages/ts-client/src/index.ts +++ b/packages/ts-client/src/index.ts @@ -12,6 +12,7 @@ export { } from './livestream'; export type { ReconnectConfig, ReconnectionStatus } from './reconnection'; export type { + ClientType, Component, ConnectConfig, CreateConfig, diff --git a/packages/ts-client/src/types.ts b/packages/ts-client/src/types.ts index f0ed786e..bd7feb9d 100644 --- a/packages/ts-client/src/types.ts +++ b/packages/ts-client/src/types.ts @@ -217,6 +217,11 @@ export type MessageEvents = { localTrackMetadataChanged: (event: Parameters[0]) => void; disconnectRequested: (event: Parameters[0]) => void; }; +/** + * Represents the type of client used. + * @category Connection + */ +export type ClientType = 'web' | 'mobile'; /** Configuration object for the client */ export interface ConnectConfig { @@ -236,4 +241,7 @@ export type CreateConfig = { * Enables Fishjam SDK's debug logs in the console. */ debug?: boolean; + + /** Type of client used */ + clientType?: ClientType; }; From ca9f0a1ec77e3b7f3f76ca06bfb17b8459271bac Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Wed, 28 Jan 2026 12:24:25 +0100 Subject: [PATCH 2/6] omit type in mobile provider --- packages/mobile-client/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index 0f4a1483..f17b0a34 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -86,7 +86,7 @@ export type { } from '@fishjam-cloud/react-client'; // persistLastDevice is not supported on mobile -export type FishjamProviderProps = Omit; +export type FishjamProviderProps = Omit; export function FishjamProvider(props: FishjamProviderProps) { return React.createElement(ReactClientFishjamProvider, { ...props, From f8572beffe15fd055c0c384d721357e84671e8ac Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Wed, 28 Jan 2026 12:31:39 +0100 Subject: [PATCH 3/6] signal internal prop to user --- packages/mobile-client/src/index.ts | 4 ++-- packages/react-client/src/FishjamProvider.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index f17b0a34..53862b24 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -86,11 +86,11 @@ export type { } from '@fishjam-cloud/react-client'; // persistLastDevice is not supported on mobile -export type FishjamProviderProps = Omit; +export type FishjamProviderProps = Omit; export function FishjamProvider(props: FishjamProviderProps) { return React.createElement(ReactClientFishjamProvider, { ...props, persistLastDevice: false, - clientType: 'mobile', + _clientType: 'mobile', }); } diff --git a/packages/react-client/src/FishjamProvider.tsx b/packages/react-client/src/FishjamProvider.tsx index f6dbebec..08c7f663 100644 --- a/packages/react-client/src/FishjamProvider.tsx +++ b/packages/react-client/src/FishjamProvider.tsx @@ -62,9 +62,10 @@ export interface FishjamProviderProps extends PropsWithChildren { */ debug?: boolean; /** - * Type of client used. + * @internal + * Internal prop to set the client type. */ - clientType?: ClientType; + _clientType?: ClientType; } /** @@ -73,7 +74,7 @@ export interface FishjamProviderProps extends PropsWithChildren { */ export function FishjamProvider(props: FishjamProviderProps) { const fishjamClientRef = useRef( - new FishjamClient({ reconnect: props.reconnect, debug: props.debug, clientType: props.clientType }), + new FishjamClient({ reconnect: props.reconnect, debug: props.debug, clientType: props._clientType }), ); const persistHandlers = useMemo(() => { From b9894231e118cb4f14040c74ee31ab1c2a808528 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Wed, 28 Jan 2026 12:35:23 +0100 Subject: [PATCH 4/6] override FishjamClient in mobile SDK --- packages/mobile-client/src/index.ts | 6 ++++-- packages/react-client/src/FishjamProvider.tsx | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index 53862b24..2a801ddc 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -10,6 +10,7 @@ import { type FishjamProviderProps as ReactClientFishjamProviderProps, useMicrophone as useMicrophoneReactClient, } from '@fishjam-cloud/react-client'; +import { FishjamClient } from '@fishjam-cloud/ts-client'; export { RTCView, RTCPIPView, type RTCVideoViewProps, type RTCPIPViewProps } from './overrides/RTCView'; export { @@ -86,11 +87,12 @@ export type { } from '@fishjam-cloud/react-client'; // persistLastDevice is not supported on mobile -export type FishjamProviderProps = Omit; +export type FishjamProviderProps = Omit; export function FishjamProvider(props: FishjamProviderProps) { + const fishjamClient = new FishjamClient({ reconnect: props.reconnect, debug: props.debug, clientType: 'mobile' }); return React.createElement(ReactClientFishjamProvider, { ...props, persistLastDevice: false, - _clientType: 'mobile', + fishjamClient, }); } diff --git a/packages/react-client/src/FishjamProvider.tsx b/packages/react-client/src/FishjamProvider.tsx index 08c7f663..8ed4d281 100644 --- a/packages/react-client/src/FishjamProvider.tsx +++ b/packages/react-client/src/FishjamProvider.tsx @@ -1,4 +1,4 @@ -import { type ClientType, FishjamClient, getLogger, type ReconnectConfig } from "@fishjam-cloud/ts-client"; +import { FishjamClient, getLogger, type ReconnectConfig } from "@fishjam-cloud/ts-client"; import { type PropsWithChildren, useMemo, useRef } from "react"; import { CameraContext } from "./contexts/camera"; @@ -62,10 +62,9 @@ export interface FishjamProviderProps extends PropsWithChildren { */ debug?: boolean; /** - * @internal - * Internal prop to set the client type. + * Allows to provide your own FishjamClient instance from ts-client. */ - _clientType?: ClientType; + fishjamClient?: FishjamClient; } /** @@ -74,7 +73,7 @@ export interface FishjamProviderProps extends PropsWithChildren { */ export function FishjamProvider(props: FishjamProviderProps) { const fishjamClientRef = useRef( - new FishjamClient({ reconnect: props.reconnect, debug: props.debug, clientType: props._clientType }), + props.fishjamClient ?? new FishjamClient({ reconnect: props.reconnect, debug: props.debug }), ); const persistHandlers = useMemo(() => { From f88a47d1dabf94c359d889762811f0cc5d96651f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Filimowski?= Date: Wed, 28 Jan 2026 18:12:12 +0100 Subject: [PATCH 5/6] Update packages/ts-client/src/FishjamClient.ts Co-authored-by: adrian <33912477+czerwiukk@users.noreply.github.com> --- packages/ts-client/src/FishjamClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ts-client/src/FishjamClient.ts b/packages/ts-client/src/FishjamClient.ts index 7fb19d61..b7e1668b 100644 --- a/packages/ts-client/src/FishjamClient.ts +++ b/packages/ts-client/src/FishjamClient.ts @@ -99,7 +99,7 @@ export class FishjamClient( this, From 55e388fc900e1bf924851adeaca902852c2061fc Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Wed, 28 Jan 2026 18:18:26 +0100 Subject: [PATCH 6/6] fix types --- packages/ts-client/src/FishjamClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ts-client/src/FishjamClient.ts b/packages/ts-client/src/FishjamClient.ts index b7e1668b..0b0f66b5 100644 --- a/packages/ts-client/src/FishjamClient.ts +++ b/packages/ts-client/src/FishjamClient.ts @@ -99,7 +99,7 @@ export class FishjamClient( this,