[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: problem with websockets

When I deploy it manually (standalone tomcat or non openshift docker container) the websocket port is 8080 since it's just a context path in tomcat. This works perfectly fine. When I deploy to openshift and expose port 8080, I'm able to hit port 80 on the router with the name that I mapped to the application and get the page and content I expect, but the websocket doesn't connect like it does when I deploy manually. I also get the same behavior with the example websocket applications included with Tomcat which work under normal conditions. So basically, the main page of my application is at http://testapp.example.com/testwebapp/ and the _javascript_ loaded connects to a websocket at ws://testapp.example.com/testwebapp/websocket. Since I get the page to load when I hit the application I know it's exposing the right port, but form some reason the websocket can't connect.

On Wed, Sep 14, 2016 at 10:49 PM, Clayton Coleman <ccoleman redhat com> wrote:
If you're using openshift v3 make sure your websocket port is also listed in your service (services list the ports they expose).  You can alter your route to point directly at your websocket port by setting the port field:

$ oc explain route.spec.port
RESOURCE: port <Object>

     If specified, the port to be used by the router. Most routers will use all
     endpoints exposed by the service by default - set this value to instruct
     routers which port to use.

    RoutePort defines a port mapping from a router to an endpoint in the service endpoints.

   targetPort   <string> -required-
     The target port on pods selected by the service this route points to. If
     this is a string, it will be looked up as a named port in the target
     endpoints port list. Required

Set it to "8000".

On Wed, Sep 14, 2016 at 10:54 AM, Tony Saxon <tony saxon gmail com> wrote:
I have an application that runs on tomcat and uses websockets. I'm able to build it and test it in a standalone docker container and it works fine. When I deploy that same image to my openshift instance the application can not connect to the websocket. After doing some research I've found some conflicting information. Older articles that i've read mention that you can only connect to websockets on openshift through port 8000 or 8443. However, the documentation at https://docs.openshift.org/latest/architecture/core_concepts/routes.html#routers seems to indicate that websockets are no different then the other protocols handled by the openshift router. Is this the case or does it need to be port 8000? If it's port 8000, do I need to configure a separate connect in tomcat in my docker container for port 8000?

users mailing list
users lists openshift redhat com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]