I have a question about the chat implemented by socket.io.

Asked 2 years ago, Updated 2 years ago, 119 views

Currently, most of the messenger functions have been completed, but the problem is that they are bringing the most recent conversation together by distributing the list of chat rooms. (ex. Kakao Talk)

The problem is that when someone sends a message in the chat room, you need to update the message you received recently and re-mark it on the list

            setInterval(function() {
                socket.emit('rooms', id);
            }, 1000);

Should I keep bringing up the list of rooms in this form...? If so, the list shown will keep blinking and the server will be burdened...

What should I do?

node.js mongoose socket.io

2022-09-22 11:51

1 Answers

Well, The source code must be the client part.

It appears to be a problem that only needs to be handled when the client receives a server event with socket.on.

You can only retrieve the information and show it again if you receive a new message from the server. It's not interval as it is now.


2022-09-22 11:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.