ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/webapps/docs/web-socket-howto.xml

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/webapps/docs/web-socket-howto.xml
Status
scanned
Type
file
Name
web-socket-howto.xml
Extension
.xml
Programming language

      
    
Mime type
text/xml
File type
XML 1.0 document, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
8089 (7.9 KB)
MD5
65fd2ec88cdd0e708ee72a89ec3f37d3
SHA1
fe2b5341f59cc4b5b1638c7944ce9ce7e3e2fbd8
SHA256
2b7010615f6b5675c44b629fb3aa3a056559adbf5b2d6580b5f2e1eff741bbd7
SHA512

      
    
SHA1_git
99f6e62610dfbc7cf9989d0b5808c085e14a3a27
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
web-socket-howto.xml | 7.9 KB |

<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE document [ <!ENTITY project SYSTEM "project.xml"> ]> <document url="web-socket-howto.html"> &project; <properties> <title>WebSocket How-To</title> </properties> <body> <section name="Table of Contents"> <toc/> </section> <section name="Overview"> <p>Tomcat provides support for WebSocket as defined by <a href="https://tools.ietf.org/html/rfc6455">RFC 6455</a>.</p> </section> <section name="Application development"> <p>Tomcat implements the Jakarta WebSocket 2.1 API defined by the <a href="https://projects.eclipse.org/projects/ee4j.websocket">Jakarta WebSocket</a> project.</p> <p>There are several example applications that demonstrate how the WebSocket API can be used. You will need to look at both the client side <a href="https://github.com/apache/tomcat/tree/main/webapps/examples/websocket"> HTML</a> and the server side <a href="https://github.com/apache/tomcat/tree/main/webapps/examples/WEB-INF/classes/websocket"> code</a>.</p> </section> <section name="Tomcat WebSocket specific configuration"> <p>Tomcat provides a number of Tomcat specific configuration options for WebSocket. It is anticipated that these will be absorbed into the WebSocket specification over time.</p> <p>The write timeout used when sending WebSocket messages in blocking mode defaults to 20000 milliseconds (20 seconds). This may be changed by setting the property <code>org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT</code> in the user properties collection attached to the WebSocket session. The value assigned to this property should be a <code>Long</code> and represents the timeout to use in milliseconds. For an infinite timeout, use <code>-1</code>.</p> <p>The time Tomcat waits for a peer to send a WebSocket session close message after Tomcat has sent a close message to the peer defaults to 30000 milliseconds (30 seconds). This may be changed by setting the property <code>org.apache.tomcat.websocket.SESSION_CLOSE_TIMEOUT</code> in the user properties collection attached to the WebSocket session. The value assigned to this property should be a <code>Long</code> and represents the timeout to use in milliseconds. Values less than or equal to zero will be ignored.</p> <p>The write timeout Tomcat uses when writing a session close message when the close is abnormal defaults to 50 milliseconds. This may be changed by setting the property <code>org.apache.tomcat.websocket.ABNORMAL_SESSION_CLOSE_SEND_TIMEOUT</code> in the user properties collection attached to the WebSocket session. The value assigned to this property should be a <code>Long</code> and represents the timeout to use in milliseconds. Values less than or equal to zero will be ignored.</p> <p>In addition to the <code>Session.setMaxIdleTimeout(long)</code> method which is part of the Jakarta WebSocket API, Tomcat provides greater control of the timing out the session due to lack of activity. Setting the property <code>org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS</code> in the user properties collection attached to the WebSocket session will trigger a session timeout if no WebSocket message is received for the specified number of milliseconds. Setting the property <code>org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS</code> will trigger a session timeout if no WebSocket message is sent for the specified number of milliseconds. These can be used separately or together, with or without <code>Session.setMaxIdleTimeout(long)</code>. If the associated property is not specified, the read and/or write idle timeout will be applied.</p> <p>If the application does not define a <code>MessageHandler.Partial</code> for incoming binary messages, any incoming binary messages must be buffered so the entire message can be delivered in a single call to the registered <code>MessageHandler.Whole</code> for binary messages. The default buffer size for binary messages is 8192 bytes. This may be changed for a web application by setting the servlet context initialization parameter <code>org.apache.tomcat.websocket.binaryBufferSize</code> to the desired value in bytes.</p> <p>If the application does not define a <code>MessageHandler.Partial</code> for incoming text messages, any incoming text messages must be buffered so the entire message can be delivered in a single call to the registered <code>MessageHandler.Whole</code> for text messages. The default buffer size for text messages is 8192 bytes. This may be changed for a web application by setting the servlet context initialization parameter <code>org.apache.tomcat.websocket.textBufferSize</code> to the desired value in bytes.</p> <p>When using the WebSocket client to connect to server endpoints, the timeout for IO operations while establishing the connection is controlled by the <code>userProperties</code> of the provided <code>jakarta.websocket.ClientEndpointConfig</code>. The property is <code>org.apache.tomcat.websocket.IO_TIMEOUT_MS</code> and is the timeout as a <code>String</code> in milliseconds. The default is 5000 (5 seconds).</p> <p>When using the WebSocket client to connect to server endpoints, the number of HTTP redirects that the client will follow is controlled by the <code>userProperties</code> of the provided <code>jakarta.websocket.ClientEndpointConfig</code>. The property is <ocde>org.apache.tomcat.websocket.MAX_REDIRECTIONS</ocde>. The default value is 20. Redirection support can be disabled by configuring a value of zero. </p> <p>When using the WebSocket client to connect to a server endpoint that requires BASIC or DIGEST authentication, the following user properties must be set: </p> <ul> <li><code>org.apache.tomcat.websocket.WS_AUTHENTICATION_USER_NAME</code> </li> <li><code>org.apache.tomcat.websocket.WS_AUTHENTICATION_PASSWORD</code> </li> </ul> <p>Optionally, the WebSocket client can be configured only to send credentials if the server authentication challenge includes a specific realm by defining that realm in the optional user property:</p> <ul> <li><code>org.apache.tomcat.websocket.WS_AUTHENTICATION_REALM</code></li> </ul> <p>When using the WebSocket client to connect to a server endpoint via a forward proxy (also known as a gateway) that requires BASIC or DIGEST authentication, the following user properties must be set: </p> <ul> <li><code>org.apache.tomcat.websocket.WS_PROXY_AUTHENTICATION_USER_NAME </code></li> <li><code>org.apache.tomcat.websocket.WS_PROXY_AUTHENTICATION_PASSWORD </code></li> </ul> <p>Optionally, the WebSocket client can be configured only to send credentials if the server authentication challenge includes a specific realm by defining that realm in the optional user property:</p> <ul> <li><code>org.apache.tomcat.websocket.WS_PROXY_AUTHENTICATION_REALM</code> </li> </ul> </section> </body> </document>
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
10.88
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 10 10
https://tools.ietf.org/html/rfc6455 37 37
https://projects.eclipse.org/projects/ee4j.websocket 42 42
https://github.com/apache/tomcat/tree/main/webapps/examples/websocket 47 47
https://github.com/apache/tomcat/tree/main/webapps/examples/WEB-INF/classes/websocket 49 49