Closed shrpne closed 1 year ago
I've implemented checking roomId
, so resilience against invalid input is improved and it is ready to merge.
I've left untouched places with unclear behavior, I can fix them later after your feedback or we can leave them as is
(BTW you may find it easier to review with disabled whitespaces, since there is a lot of updated padding https://github.com/norkator/poker-pocket-backend/pull/22/files?w=1 )
@shrpne do you want me add you as collaborator so you can freely maintain this backend as you feel right or change behaviour if something I have made makes no sense.
I was developing this long time ago and would not probably take same steps as I have been doing here.
So to answer your questions:
@shrpne will you continue working in this branch or should title "Draft:" be removed and this pr merged?
I've removed else branches and Draft title. It is ready to merge.
As for maintaining the repo, I'm not sure. I will develop a fork that will be highly opinionated to meet specific needs of my project. And I'm not sure how many features I will be able to backport to this repo, probably not many
Custom clients may send invalid
roomId
, so it will throwTypeError: rooms[roomId] is undefined
and crash the server app.Since there are also repetitive checks of
players[connectionId].connection !== null
andplayers[connectionId].socketKey === socketKey
, I would like to implement the fix by introducing helper function that will check connection and also checkroomId
when it is needed.To implement it correctly I would like to hear your feedback:
players[connectionId].connection
but not checkingsocketKey
. L543, L560, L615 etc. Is it intended? Maybe we should checksocketKey
there too?else
branches which always throw because there is noplayers[connectionId].connection.sendText
whenplayers[connectionId].connection === null
. L745, L769. How should I handle theseelse
branches?