diff --git a/src/hooks/useTSRemoteApp.tsx b/src/hooks/useTSRemoteApp.tsx index 09ec8bf..091e5d8 100644 --- a/src/hooks/useTSRemoteApp.tsx +++ b/src/hooks/useTSRemoteApp.tsx @@ -13,6 +13,8 @@ export default function useTSRemoteApp({ remoteAppPort = 5899 }: { remoteAppPort const [currentChannel, setCurrentChannel] = useState(undefined); const [currentClient, setCurrentClient] = useState(undefined); + const [clientsInChannel, setClientsInChannel] = useState([]); + useEffect(() => { const tsConnection: ITS5ConnectionHandler = new TS5ConnectionHandler( remoteAppPort, @@ -36,6 +38,13 @@ export default function useTSRemoteApp({ remoteAppPort = 5899 }: { remoteAppPort setCurrentChannel(currentChannel); } } + + if (currentChannel) { + const clientsInChannel = clients.filter((client) => { + return client.channel?.id === currentChannel?.id && client.channel.connection.id === activeConnectionId; + }); + setClientsInChannel(clientsInChannel); + } }, [clients, channels, connections, activeConnectionId]); return { @@ -46,5 +55,6 @@ export default function useTSRemoteApp({ remoteAppPort = 5899 }: { remoteAppPort currentConnection, currentChannel, currentClient, + clientsInChannel, }; }