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