ESP32 CAM with Arduino IDE | Tutorial - [Part.2] World Wide Access to ESP32CAM (feat. GCP)

This commit is contained in:
Eric
2019-11-09 15:54:24 -08:00
parent 341e6f0be3
commit f000a5ce1f
7 changed files with 1885 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<html>
<head>
<title>Client</title>
</head>
<body>
<img src="">
<script>
const img = document.querySelector('img');
const WS_URL = 'ws:///34.94.20.38:65080';
const ws = new WebSocket(WS_URL);
let urlObject;
ws.onopen = () => console.log(`Connected to ${WS_URL}`);
ws.onmessage = message => {
const arrayBuffer = message.data;
if(urlObject){
URL.revokeObjectURL(urlObject);
}
urlObject = URL.createObjectURL(new Blob([arrayBuffer]));
img.src = urlObject;
}
</script>
</body>
</html>