Questions when developing chat functionality with socket.io

Asked 2 years ago, Updated 2 years ago, 76 views

Hello.

Web development with node.js + express.

We're implementing the socket.io chat function this time.

That's all we've developed.

I understood and developed the simple message exchange part, and I would like to ask about the convenience function.

I ask for your help me! Thank you to those who always help us.

socket.io node.js chatting

2022-09-21 18:39

1 Answers

Get the message as it is, but you only need to control the input of chatting in the chat room. If you checked the login status and logged in, activate the input and if you didn't, please remove the input and log in. You can replace it with the same notification

Or, if you checked the session and logged in when you received the message from the server, you can process the message as it is, and if you are a non-login user, you can send an alert to log in.

I can think of many ways

If you import it from Save as a cookie, you have to put it in front and rear calculations well, and if you make the login ajax, you can do it right there without reloading the page. However, you have to take care of it well.

It's not that wasteful of resources to bring from the DB. I thought about that a lot, but the D.B. can withstand it better than I thought. On top of that, if it's a small site, there's no problem if it leaks a little.


2022-09-21 18:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.