flurry/test.js
peppidesu 7f04b39a15
feat: Website (#15)
Add a basic website that shows the current flutgrid state
Co-authored-by: Noa Aarts <noa@voorwaarts.nl>
2024-10-22 21:58:25 +02:00

13 lines
No EOL
386 B
JavaScript

const ws = new WebSocket("ws://127.0.0.1:3000/imgstream?canvas=0");
console.log("Connecting");
ws.onopen = () => {
console.log("Connected");
}
ws.onmessage = (msg) => {
var reader = new FileReader();
reader.readAsDataURL(msg.data);
reader.onloadend = function() {
var base64data = reader.result;
document.getElementById("image").src = base64data;
}
}