GrandTabernacleAutoVI/server/testsite/app.js
killianmarty 9705f1af83 update
2023-11-15 22:38:47 +01:00

27 lines
563 B
JavaScript

const socket = new WebSocket('ws://gtavi-9d790e61e447.herokuapp.com/');
socket.addEventListener('open', (event) => {
console.log('connecté');
});
socket.addEventListener('message', (event) => {
console.log(event.data);
});
socket.addEventListener('close', (event) => {
console.log('Connexion au serveur WebSocket fermée');
});
function main(){
socket.send(JSON.stringify({type: "connect"}));
socket.send(JSON.stringify({
type: "update",
data: {
id: 0,
x: 0,
y: 0
}
}))
}