Apache Tomcat 8.0 Server Endpoint Websocket Error 404 -


i've got static contents served correctly, web socket using @serverendpoint doesn't work. use apache-tomcat-8.0.37, eclipse j2ee.

my javascript code tries make websocket connection gets error: websocket connection 'ws://localhost:8080/chessclock/websocket/clock' failed: error during websocket handshake: unexpected response code: 404

in network tab says 0 bytes received.

what problem here?

here error got (on google chrome):

my server endpoint class:

package clock;  import java.io.ioexception;  import javax.websocket.endpointconfig; import javax.websocket.onmessage; import javax.websocket.onopen; import javax.websocket.session; import javax.websocket.server.serverendpoint;  @serverendpoint("/websocket/clock") public class clockendpoint {      @onopen     public void handleopen(endpointconfig endpointconfig, session session) {         system.out.println("incoming connection " + session.getid());         try {             session.getbasicremote().sendtext("hello");         } catch (ioexception e) {             e.printstacktrace();         }     }      @onmessage     public void handlemessage(string message, session session) {         try {             session.getbasicremote().sendtext("echo " + message);         } catch (ioexception e) {             e.printstacktrace();         }     }  } 

my servlets working not websocket. context root "chessclock".


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -