Conversation
freshfish70
left a comment
There was a problem hiding this comment.
Should you also implement the leave function to be called?
|
Have we implemented the voter leaving an election? The reasoning for me leaving the TODO is because i thought that the "socket" logic for this wasnt implemented yet |
|
If we consider the disconnect event.
So we dont have to make them leave the room if they disconnect. But if they are able to stay on same same socket connection and join another election, we have to implement room unsubscribing. |
Ok, we should discuss this since it is out of the scope for this issue :P. But i will rename the method |
|
:D I was not indicating that you should implement anything, hehe. Just removed the todo. |
Ohh sorry now i see what you meant, yeah the event is wrong, good spot! :) |
sanderhurlen
left a comment
There was a problem hiding this comment.
Looking good, peltoninho 👯 You and @freshfish70 have full control on this one 💪🏼
| if (decoded) { | ||
| if (decoded.organizer) { | ||
| organizerJoin({ ...event, data: decoded }) | ||
| event.acknowledgement(EventMessage({})) |
There was a problem hiding this comment.
I do not know, maby @freshfish70 knows :)
There was a problem hiding this comment.
Yes 👌🤩
This is for acking the joining, and We dont have any data to send back on Success full join. We Just call it to Notify frontend. The empty bracket is Just for having a default value.
There was a problem hiding this comment.
Alright. Maybe leave a comment for future ourselves
| const connectedVoters = socketServer.of('/').adapter.rooms.get(electionId.toString())?.size | ||
|
|
||
| const electionRoom = this.getRoom(electionId) | ||
| if (electionRoom) { |
There was a problem hiding this comment.
What happens if there is no electionRoom?
There was a problem hiding this comment.
Then it will return undefined, leading to the stuff inside the if-statement not happening
There was a problem hiding this comment.
Should maby add an exception, so that it will not continue with the emit
I have no idea if this is the best way to do this, but this seems to work, any comments will be very helpfull :D