Answer the question
In order to leave comments, you need to log in
Is it possible to make custom events on the client??
Hello. I'm doing a chat on a project using socket.io.
On the back, I have all the necessary endpoints (to get users, their messages, etc.)
Reading about the socket, I understood that the back must register an event using socket.io.emit.
Can I do the same on the client without the help of a back?
That is an example:
I want to receive a notification when a message arrives:
socket.on('receiveMessage', () => {
notifAllUsers();
renderUnreadMessage();
})
Answer the question
In order to leave comments, you need to log in
What does it mean to receive without the help of a bek?
Who will send the events then if not the server?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question