Tomcat websocket client frame



>我有以下代码,在java中作为websocket的clientendpoint执行

   protected void dequeue() throws InterruptedException, IOException
    {
        ByteBuffer bbuf;
        System.out.println("start");
        while((bbuf = messageQueue.take()).get(0) != 0)
        {
            bbuf.position(bbuf.limit());
            if(bbuf.get(0)== 0)
                System.out.println("here");
            bbuf.flip();
            for(Session session : sessionList)
            {
                //Thread.sleep(10000);
                if(!session.isOpen())
                    break;
                session.getBasicRemote().sendBinary(bbuf);
            }
        }
        System.out.println("end");
    }

当注释掉的Thread.sleep()放回代码中时,代码工作正常。但是,当代码中不包含Thread.sleep()时,对 websocket 的写入有时有效,而其他时候在写入第一条消息并给出以下原因后调用@onClose

CloseReason: code [1002], reason [The client frame set the reserved bits to [7] which was not supported by this endpoint]

其中[7]有时是 1,2,等等。我一直无法找到任何真正为什么会发生这种情况的东西,有没有人碰巧对正在发生的事情有任何见解?值得注意的是,我正在使用tomcat 7.0.53来托管websocket的ServerSide,并使用HTTPS而不是HTTP。

这是

由于tomcat中的以下错误,https://issues.apache.org/bugzilla/show_bug.cgi?id=57318#c1 更新到apache tomcat 7.0.57将解决此问题。更新到高于7.0.53的 apache tomcat 版本可能会解决此问题,但尚未经过测试。

最新更新