[英]Can we utilize same websocket connection again?
Usecase: 用例:
When I(Client) connected again. 当我(客户端)再次连接时。 (Is there any way that I can reutilize same websocket connection I was connected earlier? ) Or Every time I have to reconnect using new websocket connection only? (有什么方法可以重用以前连接的相同的Websocket连接?)或每次我只需要使用新的Websocket连接重新连接时?
Answer to your question heavily relies on the implementations. 对您的问题的回答在很大程度上取决于实现。 From what I know, it is possible, but.. 据我所知,这是可能的,但是..
When WebSocket support is implemented on top of Servlet 3.1 API, it might not be possible, because I don't think that servlet implementation is able to reuse upgraded connection. 当在Servlet 3.1 API上实现WebSocket支持时,可能是不可能的,因为我认为Servlet实现无法重用升级后的连接。 Additionally, it also depends on the way how the connection was closed - closing the underlying TCP connection is valid close from WebSocket RFC point of view and then you don't have anything to reuse. 此外,这还取决于关闭连接的方式-从WebSocket RFC角度来看,关闭基础TCP连接是否有效是有效的,那么您就没有任何可重用的内容。
My qualified guess would be (if you are implementing client) - if the connection is left intact after close is detected, you might try to reuse it. 我的合格猜测是(如果正在实施客户端)-如果在检测到关闭后连接保持完整,则可以尝试重用它。 Otherwise you need to open the new one. 否则,您需要打开新的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.