Websocket working on localhost but not Heroku Websocket working on localhost but not Heroku heroku heroku

Websocket working on localhost but not Heroku


ok, so finally I made it working. Turned out that Tomcat on heroku does not have the standard set of libraries.First I deployed locally on webapp-runner https://devcenter.heroku.com/articles/java-webapp-runner after which I I saw a strange error. I tested with a few libraries and finally after after adding

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

and

<build>...<plugins>    ...    <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-dependency-plugin</artifactId>        <version>2.3</version>        <executions>            <execution>                <phase>package</phase>                <goals><goal>copy</goal></goals>                <configuration>                    <artifactItems>                        <artifactItem>                            <groupId>com.github.jsimone</groupId>                            <artifactId>webapp-runner</artifactId>                            <version>8.5.11.3</version>                            <destFileName>webapp-runner.jar</destFileName>                        </artifactItem>                    </artifactItems>                </configuration>            </execution>        </executions>    </plugin></plugins>

I got it working locally. Then I added PROCFILE with following content

web:    java $JAVA_OPTS -jar myapp-ws/target/dependency/webapp-runner.jar --port $PORT myapp-ws/target/*.war

and committed to GITHUB (I have git integrated with Heroku), triggered build from within Heroku and it works.