In this blog, we’ll build a real-time chat application using Socket.io for bi-directional communication, Express.js for the server, React.js for th...
For further actions, you may consider blocking this person and/or reporting abuse
This is a great starter app, but it would be really great, if you could show us how to set up an admin to multiple user chat app. So, there is one admin and he can chat with multiple users, but each user only sees his/her own messages & the response from the admin. The admin would be able to see all users in a list and then choose which user to interact with.
This would be a brilliant real world chat app tutorial, if you don’t think it’s too complicated.
Great idea !!
But I think it's good for Bootcamp but it's too complicated for covering this in blog.
I tried creating this app in Angular, it worked pretty well, but after a while messages started to leak to the wrong user.
As I remember I sent:
As
admin
, I could then choose which user to send a message back to.Of course if the
userid
in the client, doesn’t match then the message isn’t shown. But this seems a really inefficient way of pushing data. It would be far better to only send messages from theadmin
to a specific user.However, I guess this is impossible, because a websocket cannot broadcast to specific clients? Or can it, if we take advantage of the
room
feature? Maybe if aroom
has the same id as theuserid
, then this would work?@charlesr1971 , you can create room with specific id for example jobId and add only those user's to socket room which you want to.
Is it possible to push a message back to an individual client, if multiple clients are listening to the same socket?
From what I know, a message is broadcast to every client that listens and then it is up to the front end code to filter those messages out. Obviously the
userid
is sent back with every message and if this matches the clientuserid
, then the user can view that message.But if I can set each room to a specific
userid
then presumably it will send the response back to the correct user?But maybe I am misunderstanding how a
room
works?I did read that the socket automatically allocates an incoming message to its own
room
, which is represented by a random id.@jagroop2001 ,Your blog makes difficult tasks feel like a piece of cake.
Thanks for appreciation 🥳🧡.
It would be really helpful if you will react and share this with your friends.
@works is right.
@jagroop2001 , I'm skeptical that creating a chatting application is that simple. Thank you for sharing this fantastic blog.
Thanks @john12 🧡🧡
thanks a lot for sharing
@mezieb You're welcome! 😊 I'm so happy my blog is useful for you!
yes i was integrating such functionality with socket.io,express in an angular project and you throwing more light to it help me structure things well.
@mezieb
I’m glad to hear that! Integrating with Socket.IO and Express in an Angular project sounds exciting. If you need any more tips or have questions, feel free to ask! 😊
Very Helpfull
@abdul_musavir_17097 , thanks .
If you really like my efforts please react and share.
It really motivates me to write more blogs.
Please "react" and share lol
Beautiful post right here, Thank you for putting this together
@web-dev-codi ,Thank you so much! I'm glad you liked it.
This was a sample and easy walk by through memory lane. I needed a refresher thank you .
Thanks @ronewaonly
Great, but I don't understand much... Only know NodeJS. By the way how to export console applications with it?
Thank !
However, I’m a bit confused about what you’re asking. Could you please clarify?
You're welcome. I mean how to set up everything like socket.io and the rest. Maybe make a video tutorial?
Great.
Thanks @neurabot
Nice post. Thank you. Can you tell me how/where can one deploy this application?
@lizardkinglk , Sure I am also thinking about that blog.
It's really helpful to see a detailed breakdown of the process. Nice!
@martinbaun, Glad to hear my blog is helpful for you! 😄 Thank you!
Thanks for your opinion I'm so happy to meet different people who I can chat with.
👍
This is nice bro 💯
@avisheks , thanks
There's an awesome database library for stuff like this, on the front end! Check it
@wafi_nashwan_8a9b96b6e027 ,That sounds great! I'll definitely check it out! 🚀
Can anyone share whole files structure in which mix frontend and backend
@jaikumar007 , I think this approach is not according to IT Industry standard.
This great