I see. In asynchronous mode, you do have to call EndServer() explicitly to get the OnPostServer() method to execute. This means that you'll have to handle the client closure within your class. One way to do that is to have the client send a special message shortly before closing to indicate that a disconnect is about to happen. You can then handle that message in your WebSocket server class. Another way is to do a Read() and handle the case where $$$CSPWebSocketClosed is returned.