-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Description
Inside socket connection handler we have event "message:send"
.
Clinet can send isAdmin
flag inside data.sender
, so server needs to validate this.
socket.on('message:send', function (data) {
const message = {
id: nanoid(),
body: data.body,
sender: data.sender,
date: Date.now()
};
history.emit('save', message);
chatRoom.emit('message:received', message)
});
Implementation
Client sends a token on connection opening via handshake.
So the best way I think is to get this token and if isAdmin flag present, validate inside event callback the role of user, by geting user id from token and check role from DB.
Requires advanced level of coding skills.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers