add makefile
This commit is contained in:
parent
a9cc83427c
commit
1f63c928ca
6
Makefile
Normal file
6
Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
run:
|
||||
python3 recever.py
|
||||
|
||||
install:
|
||||
cp index.html /var/www/html/index.html
|
||||
cp commander.html /var/www/html/commander.html
|
||||
0
commander.html
Normal file
0
commander.html
Normal file
36
index.html
36
index.html
@ -13,31 +13,37 @@ font-size: xx-large;">
|
||||
<canvas id="canvas" name="game"></canvas>
|
||||
<div id="clientId"></div>
|
||||
<script>
|
||||
|
||||
var clientId = Math.floor(Math.random() * (2**16)).toString();
|
||||
var clientId = -1;
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i=0; i<ca.length; i++){
|
||||
var c = ca[i].trim();
|
||||
var clientId = -1;
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i=0; i<ca.length; i++)
|
||||
{
|
||||
var c = ca[i].trim();
|
||||
if (c.indexOf("clientId") == 0){
|
||||
clientId = c.substring("clientId=".length, c.length);
|
||||
clientId = c.substring("clientId=".length, c.length);
|
||||
}
|
||||
}
|
||||
if (clientId == -1){
|
||||
clientId = Math.floor(Math.random() * 10000).toString();
|
||||
document.cookie = "clientId=" + clientId
|
||||
}
|
||||
if (clientId == -1)
|
||||
{
|
||||
clientId = Math.floor(Math.random() * 10000).toString();
|
||||
document.cookie = "clientId=" + clientId;
|
||||
}
|
||||
document.getElementById("clientId").innerHTML = "client id: " + clientId;
|
||||
|
||||
var connection = new WebSocket('ws://' + "10.254.0.1" + ':8080/', ['mbcRcRf']);
|
||||
connection.onopen = function () {
|
||||
connection.send('Connect ' + new Date());
|
||||
|
||||
connection.onopen = function ()
|
||||
{
|
||||
connection.send('Connect ' + (new Date()));
|
||||
};
|
||||
connection.onerror = function (error) {
|
||||
|
||||
connection.onerror = function (error)
|
||||
{
|
||||
console.log('WebSocket Error ', error);
|
||||
alert('WebSocket Error ', error);
|
||||
};
|
||||
connection.onmessage = function (e) {
|
||||
|
||||
connection.onmessage = function (e)
|
||||
{
|
||||
console.log('Server: ', e.data);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user