此内容没有您所选择的语言版本。

Chapter 3. WebSocket on Tomcat


3.1. About WebSocket

WebSocket is a web technology that provides bi-directional, full duplex, messages to be instantly distributed between the client and server over a single TCP socket connection. A full duplex communication allows two-way communication simultaneously.
The container provides an implementations of the WebSockets 1.0 JSR 356 API. To use the API, you must run Java 7+ and configure the APR or NIO2 HTTP/1.1 connectors of the web container.
JSR 356 is a standard for WebSocket API for Java. Developers can use JSR 356 API for creating WebSocket applications independent of the implementation. The WebSocket API is purely event driven.
Developers can use JSR 356 Java API for WebSocket to integrate WebSockets in applications on the server side as well as on the java client side. Tomcat 7 and 8 implement WebSocket protocol that adheres to JSR-356 standard.
A Java client uses JSR 356 compliant client implementation to connect to a WebSocket server. For web clients, WebSocket JavaScript API can be used to communicate with WebSocket server. The only difference between a WebSocket client and a WebSocket server is the method in which they are connected. A WebSocket client is a WebSocket point from which the connection to a peer originates. While a WebSocket server is WebSocket endpoint which is already published and awaits connections from peers.
Some of the examples where WebSocket can be used are banking applications, chat applications, multiplayer applications, and social networking applications.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat