I downloaded an example of a chat on a web socket from a github. In STS, everything works. After deploying to tomcat, at first nothing was displayed at all until it inherited the class where main from SpringBootServletInitializer is located and did not register in build.gradle:
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") Now you can successfully go to the login page, enter the chat, but you can’t write anything and the list of users is empty, and also writes a connection error. What could be the reason for this different behavior? STS, as I understand it, also launches via tomcat, but there are no errors. Can you please tell me how to get sockets in an application that runs on tomcat 8?
Update
I tried to remove the libraries that are needed for working with sockets from my application, because I read that tomcat uses its own, but the application did not start, also indicated them as providedRuntime , but this did not help.
Update 2
Found an error, in scripts there is a chatSocket.init("/ws"); line chatSocket.init("/ws"); So, I checked, it connects not with chat / ws, but with / ws, probably this is the error, I will do it right if I write something like chatSocket.init(serverPrefix+"/ws"); or is there any directive to change the root? (inconvenient, it will be necessary to change the prefix for launching via STS) Perhaps I am confusing something, I recently started learning scripts and spring.