Closed mihaialexandruanghel closed 3 years ago
This issue happens when async is disabled and websockets are not working.
Please try following these steps:
1) Add the dependency for websockets: “org.springframework:spring-websocket:
Hi! Thank you for suggestion!
Additionally to my code, I put the classes that you posted above, but nothing changed. Maybe I missed something. Do I still need the SocketIoServlet.java or the SocketIoHandler.java is enough? Because the httpHandler method from the SocketIoHandler.java is not triggered when I have the SocketIoServlet enabled and I do not know where to enable async besides in the @WebServlet annotation.
These instructions are for setting up socket.io from scratch. Try removing your existing WebSocketsConfiguration
and SocketIoServlet
class and then add the classes I mentioned in my previous comment.
Hi! It worked, now I have fewer requests! Thank you so much!
But I do have another problem now, maybe you had encountered it. Do you know what is causing this? By the way sending the messages from client to server works, but I do not know what to do with this error.
Hi! I managed to get rid of the error. I think I messed something in the handler because after I copied it again it worked. Thank you again for all the support. 👍
Issue solved!
Hi,
I am using socket.io-server-java on the BE side and socket.io-client on the FE side.
The connection to the socket is working and the communication events between BE and FE are also working. The problem is that after the client is sending multiple requests to the server repeating the connection. I know there are closed issues regarding this but nothing related to spring.
Do you know how can I fix this?
Thanks!
Ignore the fact that the request is red. The screenshot is from the server environment.
WebSocketsConfiguration.java
SocketIoServlet.java
ConnectionListener.java
Client.js