mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-22 22:34:15 +02:00
22 lines
No EOL
650 B
JavaScript
22 lines
No EOL
650 B
JavaScript
var HOST = "localhost:5000"
|
|
// var HOST = "desolate-bastion-1742.herokuapp.com";
|
|
var client = new WebSocket("ws://" + HOST);
|
|
var score = 1;
|
|
// var username = GlobalServices.username;
|
|
var username = "rand " + Math.floor(Math.random() * 100);
|
|
client.onerror = function() {
|
|
print("CONNECTION ERROR");
|
|
}
|
|
client.onopen = function() {
|
|
print("Web Socket client connected");
|
|
|
|
function sendMessage() {
|
|
if(client.readyState === client.OPEN) {
|
|
|
|
Script.setTimeout(sendMessage, 10000);
|
|
client.send(JSON.stringify({username: username, score: score}))
|
|
score++;
|
|
}
|
|
}
|
|
sendMessage();
|
|
} |