tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 51181] Add support for Web Sockets
Date Thu, 05 Jan 2012 22:33:32 GMT

--- Comment #22 from 2012-01-05 22:33:32 UTC ---
Is there any estimate when WebSockets support will be implemented?

As far as API, I would not mind if it is somewhat similar to the Comet
functionality. In fact it would be nice if the same Servlet instance could
handle both WebSocket and Comet requests.

So it may looks something like:

public class WebFrameworkServlet extends HttpServlet implements
WebSocketProcessor /*, CometProcessor*/ {

  // comet event processor
  public void event(CometEvent event) throws IOException, ServletException {
    HttpServletRequest request = event.getHttpServletRequest();
    HttpServletResponse response = event.getHttpServletResponse();
    if (event.getEventType() == CometEvent.EventType.BEGIN) {

  // WebSocket event processor
  public void event(WebSocketEvent event) throws IOException, ServletException
    WebSocketServletRequest request = event.getHttpServletRequest();
    WebSocketServletResponse response = event.getHttpServletResponse();
    // initial connection
    if (event.getEventType() == WebSocketEvent.EventType.BEGIN) {
    if (event.getEventType() == WebSocketEvent.EventType.MESSAGE) {
      // Get message
      WebSocketMessage inboundMessage = request.getMessage();
      // Send message back to the client
      response.sendMessage(new WebSocketMessage(...));

One longstanding limitation to the Tomcat Comet API is the ability to specify
"maximum send queue size threshold" to disconnect slow consumers when send
backlog crosses a limit. I have requested this in the past with no luck. This
is is absolutely critical for the production application. We had situations
when a slow consumer would block IO thread dedicated to multiple clients
eventually causing Tomcat run out of memory.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message