Answer the question
In order to leave comments, you need to log in
How to implement "mut" (mute the user) in the chat?
I'm not sure how best to implement dregs in chat.
An ordinary user can mutate the user, as it is in games, and then the specific socket that mutated the user will not receive notifications from him in the chat, that is, they will not be visible, there will be no emit event.
And there is also a chat moderator who can give a global mute for a specific period of time. Then the user will not write to the chat at all, he will be knocked out a window that he has mud and how much is left.
You can do it through the database, through socket.storage, through sessions and cookies, through an array or redis cache, even sculpt into files and then get an array through file_get_contents(). I think you can come up with at least a few more ways if you think about it, however, I would like to know how others do it, which option is best suited without unnecessary sawing and finishing.
How is it better? And what will it look like?
Answer the question
In order to leave comments, you need to log in
Here you have a message delivery mechanism. Here in it and filter, to whom and from whom it is possible to deliver, and to whom it is impossible. Store data where you store others.
My options are invented:
1) Have a separate table where you can already put a mut, ban and the like with a timeout
2) Add just a column to the database where to store the status (Status) of the user in json whether there is a mut or a ban
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question