WillB97 / srcomp-pystream

SRComp HTTP EventStream and WebSocket module
MIT License
0 stars 1 forks source link

Team changes data events are inconsistent #9

Closed PeterJCLaw closed 1 year ago

PeterJCLaw commented 1 year ago

In the existing Node/CoffeeScript implementation team events' data are in the same format as returned by the HTTP API at /team/<TLA>. This format is matched by this implementation during the bootstrap phase, but not during subsequent updates.

During updates this implementation returns a two element list containing the TLA and the expected data:

event: team
data: ["WYC", {"get": "/teams/WYC", "league_pos": 43, "location": {"get": "/locations/b-group", "name": "b-group"}, "name": "Wymondham College", "rookie": false, "scores": {"game": 77, "league": 58}, "tla": "WYC"}]

should be

event: team
data: {"get": "/teams/WYC", "league_pos": 43, "location": {"get": "/locations/b-group", "name": "b-group"}, "name": "Wymondham College", "rookie": false, "scores": {"game": 77, "league": 58}, "tla": "WYC"}
WillB97 commented 1 year ago

There seems to be some strange behaviour in the stream implementation around deleted teams, https://github.com/srobo/srcomp-stream/blob/main/srcomp.coffee#L118. It appears to send a teams message with no payload so how does the client detect which team has been removed?

PeterJCLaw commented 1 year ago

There seems to be some strange behaviour in the stream implementation around deleted teams, https://github.com/srobo/srcomp-stream/blob/main/srcomp.coffee#L118. It appears to send a teams message with no payload so how does the client detect which team has been removed?

Currently the client doesn't have a way to detect which team has been removed. They can however detect that a team has been removed. This was the cause of https://github.com/PeterJCLaw/srcomp-screens/issues/5, which is now fixed by doing what the other screens do -- reloading teams information when needed.

While it would be great to fix the lack of information on deletions, that is not the only case where pystream is currently divergent -- any change to a team currently has the latter format in pystream, meaning that the outside screens don't pick up team changes at all after they've been initially loaded.

It would obviously be great to improve the data returned such that it's possible for clients to be a bit more precise, however I don't think we should do that either as part of moving to a rewrite or this close to the competition. If, when the time comes, you'd like to be involved in defining and building those changes you'd be most welcome.