Files
dev.2ha.me/public/static/code/dhhutc-2022/0-steer-test.txt
2023-09-14 20:49:34 -07:00

23 lines
395 B
Plaintext

socket.onopen = function() {
console.log("[+] Connected!");
// Converts object to string
socket.send(JSON.stringify({
"type": "START_GAME",
"level": 1
}));
// Sends steer command after one second
setTimeout(() => {
socket.send(JSON.stringify({
"type": "SHIP_STEER",
"shipId": 0
}));
}, 5000);
};