How do I simulate a websocket disconnect manually? I'm trying to test websocket reconnect logic, and I have no way of doing this other than waiting for the browser's 10 minute websocket timeout.
With SockJS and Stomp:
socket = new SockJS(socketUrl);
stompClient = Stomp.over(socket); // global variable stompClient
Closing the underlying socket with:
socket.close();
triggered the stompClient's error handler as if the connection had been interrupted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With