Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi, On 3/24/16 3:46 PM, Luigi Suardi wrote: > Hi Chris. > > You are right. After opening a dedicated port for my Tomcat > instance all is working fine. My servlet code (Jersey resources and > ServerEndpoints) does not reference any port. Client code uses > window.location.host and picks up any port from the URL. Only > drawback is that the URL users enter in the browser contains the > port. Apparently, the hosting provider does not want to enable > websocket traffic through the front end redirectors and web > servers, which I think are Apache web servers. The dedicated port > does the trick and enables WS only for my Tomcat instance. You can always offer a "regular" URL (without port) that redirects to the URL with a port. It will make it easier for your users but have no other real effect. - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlb1RsQACgkQ9CaO5/Lv0PDz8gCgkYZWYPlhK2ijEgvmetWyHJKH Z08AoIs9A5wQyheoVdBNfaQ1AZN388Mc =LN7b -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port
Hi Chris. You are right. After opening a dedicated port for my Tomcat instance all is working fine. My servlet code (Jersey resources and ServerEndpoints) does not reference any port. Client code uses window.location.host and picks up any port from the URL. Only drawback is that the URL users enter in the browser contains the port. Apparently, the hosting provider does not want to enable websocket traffic through the front end redirectors and web servers, which I think are Apache web servers. The dedicated port does the trick and enables WS only for my Tomcat instance. Cheers, Luigi -Original Message- From: Christopher Schultz Sent: Thursday, March 24, 2016 1:33 PM To: Tomcat Users List Subject: Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port Luigi, On 3/23/16 12:26 PM, Luigi Suardi wrote: I have a working websocket based application based on Tomcat 7.0.68 examples in my local environment. There are issues (i.e. java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol) when running the same in a data center with an Apache web server front end that acts as a load balancer. It's true: the AJP protocol does not support upgrading to other protocols (e.g. websocket, HTTP/2). In this scenario, the Java hosting provider is asking me to run websocket traffic through separate dedicated port . So I would have to respond to regular HTTP requests over default 8080 port and to HTTP websocket requests over port . Is it possible to still use the annotated @ServerEndpoint or similar approach and tell it to listen on the port? How can I do this under Tomcat? You shouldn't need to do that: Tomcat will take care of the port mappings; just write your application as usual without any port numbers. If you have a client using a ws:// URL, they will connect through port and the upgrade should succeed. I'm not exactly sure how the web server will be configured to handle this, though. Or were you planning to generate ws:// URLs with embedded port numbers? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port
Luigi, On 3/23/16 12:26 PM, Luigi Suardi wrote: > I have a working websocket based application based on Tomcat 7.0.68 > examples in my local environment. There are issues (i.e. > java.lang.UnsupportedOperationException: HTTP upgrade is not > supported by the AJP protocol) when running the same in a data > center with an Apache web server front end that acts as a load > balancer. It's true: the AJP protocol does not support upgrading to other protocols (e.g. websocket, HTTP/2). > In this scenario, the Java hosting provider is asking me to run > websocket traffic through separate dedicated port . So I would > have to respond to regular HTTP requests over default 8080 port and > to HTTP websocket requests over port . Is it possible to still > use the annotated @ServerEndpoint or similar approach and tell it to > listen on the port? How can I do this under Tomcat? You shouldn't need to do that: Tomcat will take care of the port mappings; just write your application as usual without any port numbers. If you have a client using a ws:// URL, they will connect through port and the upgrade should succeed. I'm not exactly sure how the web server will be configured to handle this, though. Or were you planning to generate ws:// URLs with embedded port numbers? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port
Hello Tomcat Users, I have a working websocket based application based on Tomcat 7.0.68 examples in my local environment. There are issues (i.e. java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol) when running the same in a data center with an Apache web server front end that acts as a load balancer. In this scenario, the Java hosting provider is asking me to run websocket traffic through separate dedicated port . So I would have to respond to regular HTTP requests over default 8080 port and to HTTP websocket requests over port . Is it possible to still use the annotated @ServerEndpoint or similar approach and tell it to listen on the port? How can I do this under Tomcat? Thanks so much for any hints or examples. Gigi