Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java script quesion. How do you make a script that sends messages to a specific

ID: 3919243 • Letter: J

Question

Java script quesion.

How do you make a script that sends messages to a specific person that has the app that who are on the user's list?

What I mean is that I'm looking for a way to make a button that will send something to the other user on that person's list, "do you want to hangout?" or an alternative that allows the person asking to write a custom message to the person's list and once sent the other person will recieve it and it can respond back respond with a preset button of yes, a no button or a custom response that goes back to the person asking.

This is for aperyio btw

Explanation / Answer

This is what you need :

whenever a user joined to the server, socket details will be generated including ID. This is the ID really helps to send a message to particular people.

first we need to store all the socket.ids in array,

here name is the receiver name. Example:

So, now we can get that socket.id with the receiver name whenever we are sending message:

for this we need to know the receiver name. You need to emit receiver name to the server.

final thing is:

Hope this works well for you.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote