malomalo
malomalo

Reputation: 11

Deploy Java on Heroku. Error during WebSocket handshake: Unexpected response code: 200

I have websockets java application and I want to deploy it on Heroku. I`m using Webapp Runner to run my app. But when a client tries to connect the endpoint an error occurs:

WebSocket connection to 'wss://her-test-app.herokuapp.com/messenger%20' failed: Error during WebSocket handshake: Unexpected response code: 200

I was looking for an answer to this question, but all the answers indicated syntax errors in the code. Tell me, please, should I make any settings for Heroku or write some additional code to work with websockets on java. Thanks in advance for any help, my code is on github at https://github.com/IgnatMaloukhov/websockets-deploy-test

Upvotes: 0

Views: 274

Answers (1)

malomalo
malomalo

Reputation: 11

Dear stackoverflow users, I have found a solution to this problem. In this case, you need to add the tomcat-embed-websocket library to the pom.xml file.

<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-websocket</artifactId>
    <version>9.0.16</version>
</dependency>

Upvotes: 1

Related Questions