diff --git a/src/main/resources/static/javascript/game.js b/src/main/resources/static/javascript/game.js index e51483d..76ef306 100644 --- a/src/main/resources/static/javascript/game.js +++ b/src/main/resources/static/javascript/game.js @@ -54,6 +54,18 @@ class Board { } } +class ResponseMessage { + @JsonProperty() @JsonClassType({type: () => [String]}) + type: string; + + @JsonProperty() @JsonClassType({type: () => [String]}) + body: string; +} + +class ServerGamePlayer { + +} + const top_offset = 18; const board = new Board(); @@ -77,6 +89,13 @@ function sendMessage(message, type) { })); } +function deserializeMe(data) { + let jsonParser = new JsonParser(); + console.log(jsonParser.transform(response, { + mainCreator: () => [ResponseMessage] + })); +} + $(document).ready(function() { let chips = []; $(".chip").each(function() { @@ -94,6 +113,7 @@ $(document).ready(function() { socket.onmessage = function(e) { console.log('message', e.data); + deserializeMe(e.data); showMessage(JSON.parse(e.data)); }; diff --git a/src/main/resources/templates/game.html b/src/main/resources/templates/game.html index defad2c..43f2de8 100644 --- a/src/main/resources/templates/game.html +++ b/src/main/resources/templates/game.html @@ -247,6 +247,7 @@