effets sur l'interface web depuis python

Tests sur l'implémentation de communication interface web / backend python pour la reconnaissance de main avec webSocket
This commit is contained in:
2023-01-05 17:08:01 +01:00
parent 5c15a2837a
commit d7893c91ad
9 changed files with 119 additions and 72 deletions

View File

@@ -0,0 +1,14 @@
class WebsocketClient {
constructor(onNewEffects) {
this.socket = new WebSocket("ws://localhost:5000");
this.socket.addEventListener("open", (event) => {
this.socket.send("connected");
});
this.socket.addEventListener("message", (event) => {
let msg = JSON.parse(event.data);
if (msg.type == "effects") {
onNewEffects(msg.effects);
}
});
}
}