Skip to content

Commit

Permalink
display hash part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Duy Tran committed May 2, 2024
1 parent 66d6e9f commit 75380c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ <h2 id="player2name"> </h2>
// Update title to reflect the current version
// var titleVersion = " "; // Add the JSON variable for the string
// document.getElementById("title").innerHTML = titleVersion; // Set the title as the titleVersion

document.title = "group 24: " + message.versionNumber;
};

socket.onmessage = function(event) {
Expand All @@ -124,7 +126,7 @@ <h2 id="player2name"> </h2>

switch(message.type){
case 'typehash':
document.title = "group 24: " + message.versionNumber;
document.title = "group 24: " + message.versionNumber;
break;

case 'Grid':
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/uta/cse3310/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ public void onOpen(WebSocket conn, ClientHandshake handshake) {


// Add version next to title

String versionNumber = System.getenv("VERSION");
Message typehash = new Message(versionNumber);
String versionJSONString = gson.toJson(typehash);
broadcast(versionJSONString);
// Some stuff here that converts from GSON to JSON and send it over to the HTML

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/uta/cse3310/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Message() {

public Message(String versionNumber){
this.type="typehash";
this.versionNumber=versionNumber;
this.versionNumber=System.getenv("VERSION");
}


Expand Down

0 comments on commit 75380c5

Please sign in to comment.