How do I handle a WebSocket close from the client in Yaws?
问题 I have implemented a simple appmod that handle WebSockets and echo back the messages. But how do I handle an ws.close(); from the JavaScript client? I have tried with the code below, but handle_message({close, Reason}) is never called and ws.onclose = function(evt) {} is never executed on the JavaScript client. When I use the same JavaScript client code interacting with a node.js websocket, the client receives an onclose event immediately after ws.close(); . Here is the code for my simple