我是否需要告诉 Apache Tomcat 保持 Websocket 连接打开? [英] Do I need to tell Apache Tomcat to keep a Websocket connection open?

查看:35
本文介绍了我是否需要告诉 Apache Tomcat 保持 Websocket 连接打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试 Apache Tomcat Websocket 实现.问题是,连接总是在最多 30 秒空闲时间后关闭.

I am trying the Apache Tomcat Websocket Implementation. The Problem is, that the connection always gets closed after at most 30 seconds of idle time.

我是否需要配置 Tomcat 以保持连接打开?如果是这样,我该怎么做?我尝试在 server.xml 的 Connector 元素中为 HTTP 协议设置 connectionTimeout.这没有任何影响,但我不知道它是否不起作用,因为我没有将协议属性调整为特定于 websocket 的内容(因为我不知道该协议声明是什么样的).

Do I need to configure Tomcat so that it keeps the connection open? If so how can I do that? I tried to set up the connectionTimeout in the Connector element of the server.xml for the HTTP protocol. That had no effect, but I don't know if it just doesn't work because I didn't adjust the protocol attribute to something websocket specific (since I don't know what that protocol declaration looks like).

或者可能是客户端问题.

Or is it perhaps a client-side problem.

感谢您的帮助,
狮子座

Thanks for helping,
Leo

此问题已通过 Tomcat 7.0.28 解决(错误描述changelog)

edit: This Problem has been solved with Tomcat 7.0.28 (Bug Description, changelog)

推荐答案

Tomcat 有 WebSocket 的几个问题,其中之一是在 20 秒后关闭连接(这是 server.xml 中的 connectTimeout 值).增加该值以解决问题.

Tomcat has several issues with WebSocket, and one of them is it close the connection after 20 seconds (this is the connectTimeout value in server.xml). Increase that value to workaround the issue.

--让弗朗索瓦

这篇关于我是否需要告诉 Apache Tomcat 保持 Websocket 连接打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆