Skip to content

Instantly share code, notes, and snippets.

@nenkoru
Created May 16, 2025 11:04
Show Gist options
  • Select an option

  • Save nenkoru/d6b31355150792087c26b8fc9296632b to your computer and use it in GitHub Desktop.

Select an option

Save nenkoru/d6b31355150792087c26b8fc9296632b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Screen Capture Client</title>
</head>
<body>
<img id="screen" alt="Screen capture" />
<script>
const img = document.getElementById('screen');
//const ws = new WebSocket('ws://localhost:8080/ws');
const ws = new WebSocket('ws://172.29.71.57:8080/ws');
ws.onmessage = (event) => {
const blob = new Blob([event.data], { type: 'image/jpeg' });
img.src = URL.createObjectURL(blob);
};
ws.onclose = () => {
console.log('WebSocket connection closed');
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment