sending message in correct format

This commit is contained in:
Eric Levin 2015-11-16 12:47:16 -08:00
parent 4e9be8cdd0
commit eca11d3a99
2 changed files with 13 additions and 9 deletions

View file

@ -1,18 +1,22 @@
var HOST = "localhost:5000"
// var HOST = "https://thawing-hamlet-8433.herokuapp.com/";
// var HOST = "localhost:5000"
var HOST = "desolate-bastion-1742.herokuapp.com";
var client = new WebSocket("ws://" + HOST);
client.onerror - function() {
console.log("CONNECTION ERROR");
var score = 1;
var username = GlobalServices.username;
client.onerror = function() {
print("CONNECTION ERROR");
}
print("TESSST");
client.onopen = function() {
print("Web Socket client connected");
function sendMessage() {
// if(client.readyState === client.OPEN) {
client.send("HEY");
Script.setTimeout(sendMessage, 1000);
// }
if(client.readyState === client.OPEN) {
Script.setTimeout(sendMessage, 3000);
client.send(JSON.stringify({id: score, username: username, score: score}))
score++;
}
}
sendMessage();
}

View file

@ -167,7 +167,7 @@ public:
AvatarData();
virtual ~AvatarData();
static const QUrl& defaultFullAvatarModelUrl();
static const QUrl& defaultFullAvatarcodelUrl();
virtual bool isMyAvatar() const { return false; }