How to join a Windows Remote Desktop Connection session?
It's quite easy. Get your user to log into an RDP session. Then log into the same server using your credentials. Go to Remote Desktop Services Manager. Then right click on the Active user whose session you want to join and click Remote Control. They will receive a permission message and that's it - you're in the same session.
Related videos on Youtube
Bill
Updated on September 18, 2022Comments
-
Bill over 1 year
Occasionally a
newItem
is received from a WebSocket and gets saved to useState withsaveNewItem
this then kicks off the
useEffect
block as expected.Update. If there is an object in the
closeArray
with the sameopenTime
as thenewItem
I want to replace that object incloseArray
with thenewItem
because it will have a newclose
Add. If there isn't an object in the
closeArray
with the same open time asnewItem
I want to push the new item into the array.Remove. And finally, if the array gets longer than 39 objects I want to remove of the first item.
If I add
closeArray
to the array ofuseEffect
dependencies I'm going to create a nasty loop, if I don't add itcloseArray
isn't going to get updated.I want
usEffect
to only fire off whennewItem
changes and not ifcloseArray
changes, but I still want to get and set data tocloseArray
inuseEffect
interface CloseInterface { openTime: number; closeTime: number; close: number; } function App() { const [newItem, saveNewItem] = useState<CloseInterface>(); const [closeArray, saveCloseArray] = useState<CloseInterface[]>([]); useEffect(() => { if (newItem) { let found = false; let arr = []; for (let i = 0; i < closeArray.length; i++) { if (closeArray[i].openTime === newItem.openTime) { found = true; arr.push(newItem); } else { arr.push(closeArray[i]); } } if (found === false) { arr.push(newItem) } if (arr.length === 39) arr.shift(); saveCloseArray(arr); } }, [newItem]); // <--- I need to add closeArray but it will make a yucky loop
If I do add
closeArray
to theuseEffect
dependancy array I get the error...index.js:1 Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render. in App (at src/index.tsx:9) in StrictMode (at src/index.tsx:8)
if I don't add
closeArray
to theuseEffect
dependancy array I get this error...React Hook useEffect has a missing dependency: 'closeArray'. Either include it or remove the dependency array react-hooks/exhaustive-deps
the second
useEffect
block gets the initial data forcloseArray
and listens to a WebSocket that updatesnewItem
as it arrives.useEffect(() => { const getDetails = async () => { const params = new window.URLSearchParams({ symbol: symbol.toUpperCase(), interval }); const url = `https://api.binance.com/api/v3/klines?${params}&limit=39`; const response = await fetch(url, { method: "GET" }); const data = await response.json(); if (data) { const arrayLength = data.length; let newcloseArray = []; for (var i = 0; i < arrayLength; i++) { const openTime = data[i][0]; const closeTime = data[i][6]; const close = data[i][4]; newcloseArray.push({ openTime, closeTime, close }); } saveCloseArray(newcloseArray); const ws = new WebSocket("wss://stream.binance.com:9443/ws"); ws.onopen = () => ws.send( JSON.stringify({ method: "SUBSCRIBE", params: [`${symbol}@kline_${interval}`], id: 1 }) ); ws.onmessage = e => { const data = JSON.parse(e.data); const value = data.k; if (value) { const openTime = value.t; const closeTime = value.T; const close = value.c; saveNewItem({ openTime, closeTime, close }); } }; } }; getDetails(); }, [symbol, interval]);
-
Ramhound almost 11 yearsIts my understand that Desktop versions of Windows didn't even support multiple sessions.
-
GJ. almost 11 years@Ramhound I'm not referring to multiple sessions (which would allow independent usage and effectively violate the single-license of the desktop version), but to multiple users connected to the same session -- much in the way that VNC normally allows.
-
Bill about 4 yearsyes react throws an error in the console asking me to add it to the dependency array
-
wxker about 4 yearsIn that case, please add the error to your question.
-
Bill about 4 yearsadded thanks for the improvement suggestion
-
wxker about 4 yearsOk, good that you've added the error when
closeArray
is in the dependency array. What about when it isn't? Is there an error then? If so please add it in as well. -
Derek about 4 yearsYou're always calling
saveCloseArray
with a new array object, so that's why it always rerenders when you havecloseArray
as a dependency. You probably want to use the function updater syntax so you don't need the dependency, and basically just update the single entry in the array that needs to change. This operation is also better suited for auseCallback
.
-
-
wxker about 4 yearsThis looks fine as it is. Is not having
closeArray
inuseEffect
's second argument causing any problems? -
Bill about 4 yearsDerek, thanks for this, I don't have a button, the new item is coming from a WebSocket that then saves the new item to
saveNewItem
can I just addnewItem
to the dependency array ofupdateEntry
in your answer? -
Derek about 4 yearsno, you would simply use
updateEntry
in the handler of your websocket event. Please post as much of your relevant code as possible, makes it easier to help with the right solutions. -
Bill about 4 yearsI gave it a try and I get the error ` Line 56:6: React Hook useEffect has a missing dependency: 'closeArray'. Either include it or remove the dependency array. You can also do a functional update 'saveCloseArray(c => ...)' if you only need 'closeArray' in the 'saveCloseArray' call react-hooks/exhaustive-deps`
-
Shubham Khatri about 4 years@Bill My mistake, updated my answer, instead of
closeArray
you had to useprevCloseArray