You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/12/10 10:49:29 UTC

svn commit: r1644358 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

Author: markt
Date: Wed Dec 10 09:49:28 2014
New Revision: 1644358

URL: http://svn.apache.org/r1644358
Log:
Add a comment to explain handling of messages sent by the server immediately after the WebSocket connection is established.

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1644358&r1=1644357&r2=1644358&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Wed Dec 10 09:49:28 2014
@@ -378,6 +378,16 @@ public class WsWebSocketContainer
         endpoint.onOpen(wsSession, clientEndpointConfiguration);
         registerSession(endpoint, wsSession);
 
+        /* It is possible that the server sent one or more messages as soon as
+         * the connection was opened. Depending on the exact timing of when
+         * those messages were sent they could be sat in the input buffer
+         * waiting to be read and will not trigger a "data available to read"
+         * event. Therefore, it is necessary to process the input buffer here.
+         * Note that this happens on the current thread which means that this
+         * thread will be used for any onMessage notifications. This is a
+         * special case. Subsequent "data available to read" events will be
+         * handled by threads from the AsyncChannelGroup's executor.
+         */
         wsFrameClient.startInputProcessing();
 
         return wsSession;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org