As i know maintain a data structure to store the list of blocked users for each user. This data structure can be a key-value store, such as a database or an in-memory cache. When a user (userB) wants to block another user (userA), update the blocked user list for userB by adding userA to the list. https://www.myccpay.me/ This update should happen in the database or cache. In your socket.io server, before sending a message from userA to userB, check if userB has blocked userA. You can do this by querying the blocked user list for userB.
Jun 28, 2023
1
Level 1
Socket io chat server
I am building a chat server in socket io with express. I want to implement block user feature. A user can have multiple sockets if they are logged in from multiple devices. How do I prevent a user (userA) from sending messages to the other user (userB) https://xender.vip/ , if userB blocks userA after the socket connection is already established for userA and userB and more importantly the block should work for multi node socket server as well.
Please or to participate in this conversation.