add makefile
This commit is contained in:
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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user