<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
</body>
</html>
var roboturl="ws://23.94.36.254:1880/204"
var robotSocket = new WebSocket(roboturl);
var msg = '';
robotSocket.onmessage = function(event) {
msg = event.data;
var binaryType = robotSocket.binaryType;
console.log(binaryType);
console.log(msg);
document.getElementById("footer").innerHTML ="Robot "+robotNumber+" says: "+ msg;
};
// exampleSocket.onopen = function (event) {
// exampleSocket.send("reallyreally");
// console.log("Open succesfully");
// };
robotSocket.onclose = function(event) {
// By the server/me or both?
console.log("Connection closed");
};
window.onload = function(){
var button2 = document.createElement('button');
button2.innerHTML = 'Push Me!';
button2.onclick = function(){
robotSocket.send("lester,tie/2/250/0/0/0");
};
document.body.appendChild(button2);
};
/* Styles go here */
body {
padding: 20px;
}
button {
margin-top: 20px;
margin-right:10px;
line-height: 100px;
font-weight: bold;
padding: 0 0px;
background: red;
border: none;
width:30%;
}
button:hover {
background: lightsalmon;
}