Info: WebSocket connection is closed, code: 1006 when trying to run web memory samples

I embedded tomcat 8.0.20 and used it on my server. I create a webcocket tomcat example, and when I try to run it on my server for all 4 examples (Echo, chat, etc.), I get

Information: WebSocket connection is closed, Code: 1006

In the console, it prints something like (URL is correct for sample)

Connection to WebSocket for 'ws: // localhost: 9763 / examples / websocket / echoProgrammatic' failed: WebSocket handshake error: Unexpected response code: 302

When I deploy this to tomcat, it shows error 404 instead of 302.

Can someone tell me what could be causing this?

In pom, my dependency is as follows

 <dependency>
     <groupId>javax.websocket</groupId>
     <artifactId>javax.websocket-api</artifactId>
     <version>1.0</version>
     <scope>provided</scope>
 </dependency>

, websocket . - ?

+4
2

. tomcat URL- , - ( s). .

0

<dependency> <groupId>javax.websocket</groupId> <artifactId>javax.websocket-api</artifactId> <version>1.0</version> <scope>provided</scope> </dependency>

API- websocket websocket, Tomcat (groupId: org.apache.tomcat), .

Maven, pom res/maven .

"" , , .

BTW, Tomcat WebSocket 1.1.

websocket javax.servlet.ServletContainerInitializer( META-INF/services/javax.servlet.ServletContainerInitializer tomcat-websocket.jar).

+4

Source: https://habr.com/ru/post/1584411/


All Articles