Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disconnect a session ? #18

Closed
dorroddorrod opened this issue Dec 23, 2021 · 3 comments · Fixed by #20
Closed

How to disconnect a session ? #18

dorroddorrod opened this issue Dec 23, 2021 · 3 comments · Fixed by #20
Labels

Comments

@dorroddorrod
Copy link

Hi,
How can i disconnect a session from a noVNC client ?
I noticed when i'm not disconnecting and move to other page in my application and then trying to reconnect again its getting stuck cause the session is still there.

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 0.2.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@roerohan
Copy link
Owner

roerohan commented Feb 19, 2022

Thanks for raising this issue @dorroddorrod !

I've recently added v0.2.9
You can use a ref (such as the following) to access the connect() and disconnect() methods.

const vncScreenRef = useRef<React.ElementRef<typeof VncScreen>>(null);

Here's a sample of how to use the ref.

react-vnc/src/App.tsx

Lines 40 to 53 in f7b77d8

<div style={{ margin: '1rem' }}>
<button
onClick={() => {
const { connect, connected, disconnect } = vncScreenRef.current ?? {};
if (connected) {
disconnect?.();
return;
}
connect?.();
}}
>
Connect / Disconnect
</button>
</div>

@roerohan
Copy link
Owner

roerohan commented Feb 27, 2022

In #28 , I've also added support for the following methods from RFB

sendCredentials,
sendKey,
sendCtrlAltDel,
focus,
blur,
machineShutdown,
machineReboot,
machineReset,
clipboardPaste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants