Closed arangace closed 3 years ago
@arangace @sjun521 @Akunda-p
On song end, implementing extra logic on the server/database to only operate on the first "song end" message received is redundant and impossible.
To check whether a "song end" message is the first instance received:
songEnded
field will need to be defined and set in the database, which means a mongoose call will need to be made everytime a "song end" message is received in order to fetch the field, which is no quicker than attempting a mongoose call to delete a song and failing.The only way to reduce server load is to prevent clients from emitting a message to the server.
This brings me to think, instead of deleting the song from the backend on a socket listener,
songs-dao.js
?playlist[0]=currentSong
?
Certain player events should trigger an emit message from the client to the server and cause the backend to execute certain logic.
currentSong
object and aisLastSong
boolean as the payload.