summaryrefslogtreecommitdiff
path: root/scripts/client.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-02-28 02:33:14 -0500
committerKyle Gunger <corechg@gmail.com>2020-02-28 02:33:14 -0500
commitab88ba8d0e23999f4d55a2721f610eff2b1d2054 (patch)
treea98692cd60598d34c73b089ffac4dc263c13623c /scripts/client.js
parenta4d0d1190b74cd1bfb596b8a02a2deacce3ad86c (diff)
More comments
Diffstat (limited to 'scripts/client.js')
-rw-r--r--scripts/client.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/client.js b/scripts/client.js
index b5dd4bf..ea62e26 100644
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -13,12 +13,13 @@ function Client(serveraddr, game) {
}
Client.prototype = {
+ // Initialize the connection
init: function() {
this.soc.init();
},
- // Entry point for a message.
- // If it's a close message, the
+ // Entry point for a message from the server.
+ // If it's a close message, we close the game if it is open and change the lobby to reflect the error/close.
cb: function(m) {
console.log(m);
@@ -42,6 +43,7 @@ Client.prototype = {
}
},
+ // Called when negotiating with the server for the first time and we are determining versions
handshake: function(m) {
switch (m.type) {
case "verr":
@@ -57,6 +59,7 @@ Client.prototype = {
}
},
+ // Lobby switch, called when in the lobby and a message arrives from the server
lobby: function (m) {
switch (m.type) {
case "plist":
@@ -87,6 +90,7 @@ Client.prototype = {
}
},
+ // Game switch, called when in game and a message arrives from the server
game: function (m) {
switch (m.type) {