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

Re: problem with websockets

I'll see what I can turn on. Right now I don't see anything showing up in the standard catalina.out.

On Thu, Sep 15, 2016 at 4:54 PM, Clayton Coleman <ccoleman redhat com> wrote:
Ben, Ram, any ideas?  We test web sockets frequently so I assume there's something slightly different about how this app works in docker vs being behind the router.  Maybe the headers we send getting misinterpreted via Tomcat?

Tony, any errors showing up in tomcat logs (or can you turn on verbose logging and verify that you see the incoming websocket attempt)?

On Thu, Sep 15, 2016 at 4:50 PM, Tony Saxon <tony saxon gmail com> wrote:
I ended up adding the port to the route configuration, and now i don't even get the error immediately. It's almost like it hangs trying to establish the websocket connection and only shows the error briefly if I navigate to another page. Here's the route configuration:

[root os-master ~]# oc get route -o yaml
apiVersion: v1
- apiVersion: v1
  kind: Route
    creationTimestamp: 2016-08-16T19:34:58Z
      app: testwebapp
    name: testwebapp
    namespace: testwebapp
    resourceVersion: "1823387"
    selfLink: /oapi/v1/namespaces/testwebapp/routes/testwebapp
    uid: 843470f8-63e8-11e6-95e9-525400f41cdb
    host: testwebapp.example.net
      targetPort: 8080
      kind: Service
      name: testwebapp
    - conditions:
      - lastTransitionTime: 2016-08-16T19:34:58Z
        status: "True"
        type: Admitted
      host: testwebapp.example.net
      routerName: ha-router-east
kind: List
metadata: {}

On Wed, Sep 14, 2016 at 11:25 PM, Tony Saxon <tony saxon gmail com> wrote:
Not directly in the browser. If I bring up the web developer section of my browser and view the console I see an error about being unable to connect to the websocket for both my application and the built in tomcat examples.

On Wed, Sep 14, 2016 at 11:21 PM, Clayton Coleman <ccoleman redhat com> wrote:
The router should support transparent connection upgrade in that case.  Are you getting any errors in your browser?

On Wed, Sep 14, 2016 at 11:15 PM, Tony Saxon <tony saxon gmail com> wrote:
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]