java - Exception occur when refresh page in Tomcat JSR 356 websocket -


i have serverendpoint class:

@serverendpoint(value = "/websocket", configurator = servletawareconfig.class) public class websocketendpoint {      @onopen     public void onopen(session session) {         system.out.println("onopen");     }      @onclose     public void onclose(session session) {         system.out.println("onclose");     }      @onmessage     public void onmessage(string message, session session) {         system.out.println("onmessage");     }      @onerror     public void onerror(throwable t) throws throwable {         system.out.println("onerror");     } } 

when refresh page, onerror invoked , exception t contains next description: java.util.concurrent.executionexception: java.net.socketexception: broken pipe

what can reason?

i meet same exception when use chrome or chromium open page. (it never occurs when use firefox). i'm not sure if using chrome too. guess because of v8 engine.

my solution close web socket before leaving page:

window.addeventlistener ("beforeunload", function(){ socket.close(); });

but have not seen exceptions when use tyrus web socket server. hopes can show direct reason of problem. thanks!


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -