You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jesse Schulman <je...@dreamtsoft.com> on 2019/02/07 00:31:59 UTC

HTTP2 with WebSockets

Is it possible for tomcat to run with HTTP2 and WebSockets on the same
connector?  I have tried configuring it myself and looked for examples
without success.

Thanks!
Jesse

Re: HTTP2 with WebSockets

Posted by Jesse Schulman <je...@dreamtsoft.com>.
I could add a second port but then I’d have to change how the load balancer
works to add even more magic there than I already have... not sure http2 is
worth that effort.
On Wed, Feb 6, 2019 at 6:54 PM John Larsen <jo...@javapipe.com> wrote:

> I am interested in this too. Basically we've had to set another port in
> which the app can access tomcat for websockets directly. We've not been
> able to get this to work over httpd.
> John
>
>
> On Wed, Feb 6, 2019 at 5:32 PM Jesse Schulman <je...@dreamtsoft.com>
> wrote:
>
> > Is it possible for tomcat to run with HTTP2 and WebSockets on the same
> > connector?  I have tried configuring it myself and looked for examples
> > without success.
> >
> > Thanks!
> > Jesse
> >
>

Re: HTTP2 with WebSockets

Posted by John Larsen <jo...@javapipe.com>.
I am interested in this too. Basically we've had to set another port in
which the app can access tomcat for websockets directly. We've not been
able to get this to work over httpd.
John


On Wed, Feb 6, 2019 at 5:32 PM Jesse Schulman <je...@dreamtsoft.com> wrote:

> Is it possible for tomcat to run with HTTP2 and WebSockets on the same
> connector?  I have tried configuring it myself and looked for examples
> without success.
>
> Thanks!
> Jesse
>

Re: HTTP2 with WebSockets

Posted by Mark Thomas <ma...@apache.org>.
On 07/02/2019 00:31, Jesse Schulman wrote:
> Is it possible for tomcat to run with HTTP2 and WebSockets on the same
> connector?  I have tried configuring it myself and looked for examples
> without success.

This works out of the box.

I have confirmed the behaviour with my local build of 9.0.x but nothing
has changed in this area for a number of releases.

First you need an HTTP/2 capable connector. That means:

Tomcat 8.5.x or Tomcat 9.0.x

NIO or NIO2 + JSSE + Java 9 or later
or
APR/Native
or
NIO or NIO2 + OpenSSL (via Tomcat Native)

If no explicit Java version is mentioned then any supported version of
Java for the version of Tomcat being used is fine.

Configure TLS.

Browse to http://localhost:8443

Observe in browser that HTTP/2 is used

Navigate to https://localhost:8443/examples/websocket/snake.xhtml and
you'll see HTTP/2 being used for the static content and wss (not over
HTTP/2) being used for the WebSocket traffic.

All over the single TLS enabled connector listening on port 8443.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org