diff --git a/appengine/channel/index.html b/appengine/channel/index.html index fe61cff3bb0..df5b0c631d6 100644 --- a/appengine/channel/index.html +++ b/appengine/channel/index.html @@ -137,6 +137,7 @@ return state.userX == state.me ? 'X' : 'O'; }; +// [START open_socket] sendMessage = function(path, opt_param) { path += '?g=' + state.game_key; if (opt_param) { @@ -147,11 +148,18 @@ xhr.send(); }; + onOpened = function() { + sendMessage('/opened'); + }; +// [END open_socket] + +// [START update_state] moveInSquare = function(id) { if (isMyMove() && state.board[id] == ' ') { sendMessage('/move', 'i=' + id); } }; +// [END update_state] highlightSquare = function(id) { if (state.winner != "") { @@ -172,10 +180,6 @@ } }; - onOpened = function() { - sendMessage('/opened'); - }; - onMessage = function(m) { newState = JSON.parse(m.data); state.board = newState.board || state.board;