top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Tomcat Websocket Implementation [CLOSED]

0 votes
394 views

I'm looking into a solution that will make extensive use of websockets. Details are unimportant, but here's the question that I'd like to have some insight into. The current implementation (official example) seems independent of the JSR 356.
Is work underway to implement the javax.websocket.* objects, or is what's in org.apache.catalina.websocket it for the enforceable future?

closed with the note: None
posted Aug 2, 2013 by Amit Parthsarthi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
 
Best answer

Tomcat 8 has a completed (though not yet fully tested and vetted) implementation of JSR-356.

Though Tomcat 8 is the only Tomcat that will support the Servlet, JSP, and EL specifications included in Java EE 7 (they will not be back-ported to Tomcat 7), a decision was made a while ago to deprecate the existing Tomcat 7 WebSocket implementation and back-port JSR-356 to Tomcat 7. This is the only Java EE 7 component that will be back-ported to Tomcat 7, AFAIK. I don't personally know this will happen (I'm not one of the developers), but since the JSR-356 implementation in Tomcat 8 is complete now, it shouldn't be too long.

If you want to play with the JSR-356 implementation for now, feel free to download and use Tomcat 8 RC1 when it releases in (hopefully) the next few days. We encourage it, because the more people who download it and try it out, the better our chances of chasing down and fixing bugs now instead of after a general release.

answer Aug 2, 2013 by Salil Agrawal
Similar Questions
0 votes

Is it true that current servlet-based websocket implementation will be deprecated due to the implementation of the JSR-356. We are currently implementing a Tomcat 7-based websocket server implementation that we hoped could scale up to at least 50K concurrent connections [or more], but are concerned if there are any known issues and/or limitations with the websocket implementation in Tomcat 7.

We are currently trying to test how high Tomcat 7 will scale with regards to the maximum number of concurrent websocket connections, but have already hit some problems with only 200 concurrent connections. Perhaps it's our multi-threaded client, or Tomcat configuration - not sure at this point. We have the Tomcat Connector configured with maxConnections=50000 and maxThreads=1000, so 200 concurrent connections shouldn't be a problem.

If anyone could elaborate on the Tomcat 7 servlet websocket implementation stability from a highly concurrent aspect that would be great. Additionally, if anyone has achieved 10(s) of 1000(s) of concurrent websocket connections with Tomcat 7, can you share how Tomcat was configured, what OS it was running on, and what client library you used in testing this?

+2 votes

Is there a standard way to access ServletContext from a WebSocket ServerEndpoint ?

+2 votes

In our current generation web application we used session replication with tomcat clustering. (and a load balancer). That way, we received an auto fail-over when a client sends an ajax request to a tomcat node that failed.

In our next generation web application, We would like to have a similar behavior, only with web-sockets. So my questions are :

1) Is it possible ?
2) Does it involve websocket-session replication? if so, are there any guides on how to do that?

+3 votes

As we start load testing our jsr-356 applications, I'd like to find out if there are any websocket-specific connector settings we should be aware of for tuning the underlying websocket connection processing. Since this is a tcp socket at the end of the day, I'm assuming all the socket.* options still apply if needed.

+1 vote

I'm trying to figure out how to get access to the cookies and headers passed up in the Websocket handshake request on Tomcat 8.

In Tomcat 7 the whole HttpServletRequest was passed into the WebSocketServlet. createWebSocketInbound method so it was easy to grab from the request headers. In Tomcat 8 the querystring and URI are both exposed by the javax.websocket.Session passed to ServerEndPoint.onOpen, but I don't see a mechanism for getting the cookies or headers.

We are integrating Websocket connections into an existing web app and want to use the cookies set by our web app in the Websocket connection process.

...