]> git.cworth.org Git - empires-server/commit
game: Rename Game.clients to Game.players, combining multiple connections
authorCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 12:31:15 +0000 (05:31 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 14:28:57 +0000 (07:28 -0700)
commit4c810ccb16ea6cfcdcb7f507aea2affc2c36f163
tree3808d5d74fc3ff0c3a9e1451d10a8f3cb7129873
parentee64666099c0401afdc1e51fe378359f943d3f69
game: Rename Game.clients to Game.players, combining multiple connections

Previously we were simply storing an array of "clients", one for every
request to the /events endpoint.

Now, the array of "players" is similar, but there is only one item in
the array for each unique session ID, but where each one may have
multiple "connections", (for a case where a player connects multiple
times with the same session ID).

In this commit we're not making large changes to the Empires class to
take advantage of this new functionality, (for example, it already has
unique session identification as part of its "spectators"
notion). Instead, we make a minimal change Empires so that it doesn't
step on the base "players" property.

In the future, we'll be able to port Empires forward to use this
base-class functionality and in the process delete some code from the
Empires class.
empires.js
game.js