跳至内容

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

已提问 6 年前652 查看次数
1 回答
0

I used onbeforeunload Event, so my problem resolved

已回答 6 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。