Solution to spring websocket 404 error

Recently, when learning spring websocket, write the code according to the example in spring in action, and the runtime browser reports 404 error

WebSocket connection to 'ws://localhost/websocket/marco' Failed: Error during WebSocket handshake: Unexpected response code: 404

According to the steps in Spring IN ACTION: first, inherit AbstractWebSocketHandler, overload the following 3 methods: - handleTextMessage C processing text type message - afterConnectionEstablished C new connection establishment after the call afterConnectionClosed C connection closed after the call

Second, use javaconfig to enable websocket and map message processors

Finally, write front-end JS code to initiate connection request and subsequent message interaction

After deployment, open the browser to run, and directly report 404 error

I searched the Internet for solutions all night, including the reference stack overflow The experience on. Com has not solved this problem until you see the following article: the solution to the 404 problem of spring integrated websocket page access

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>