C
C
campus12018-07-29 18:37:07
Socket.io
campus1, 2018-07-29 18:37:07

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

1 answer(s)
A
Alexander Aksentiev, 2018-07-29
@Sanasol

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 question

Ask a Question

731 491 924 answers to any question