Websocket: display users online, how to send message when clien disconnect

1

I am doing the function of displaying users who are online using websocket. I follow here: https://github.com/aws-samples/simple-websockets-chat-app I've done successfully. It will create 3 lambda function: onConnect, sendMess, onDisconnect. Receiving and sending messages to all clients is ok. If a user accesses the website, will send that user data(name, avatar..) to the server.

But I currently don't know how to handle connect and disconnect on the server with that data. How to send message from server to all client when a client disconnect. Hope you can teach me. Thank you very much.
(image - show users online) https://i.stack.imgur.com/h6e3Q.png

Edited by: Namlq on Nov 10, 2019 7:01 PM

Namlq
asked 4 years ago497 views
1 Answer
0

I used onbeforeunload Event, so my problem resolved

Namlq
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions