WebSockets它是HTML5中强大的通信功能,定义了一个全双工的通信信道,只需Web上的一个 Socket即可进行通信,能减少不必要的网络流量并降低网络延迟。HTML5 WebSockets能使数据从几千字节减少到两字节,延迟从150ms 减少到50ms,并且完美淘汰传统的Comet和Ajax轮询(polling)、长轮询(long-polling)以及流(streaming)解决方案。
目前实时Web应用的实现方式,大部分是围绕轮询和其他服务器端推送技术展开的,其中最著名的是Comet。Comet技术可以让服务器主动以异步方式向客户端推送数据。使用轮询时,浏览器定期发送HTTP请求,并随即接收响应;使用长轮询时,浏览器向服务器发送一个请求,服务器会在一段时间内将其保持在打开状态;使用流 解决方案时,浏览器会发送一个完整的HTTP请求,但服务器会发送并保持一个处于打开状态的响应,该响应持续更新并无限期处于打开状态。
以后可以愉快的用rtc搞即时通信方面的功能了,比如聊天、推送等。
升级描述:(v8.0 rc9版本)
"TRtcHttpClient", "TRtcHttpServer", "TRtcDataRequest" and "TRtcDataProvider"
components have been extended with "Web Socket" support when working with
socket-based APIs ("TRtcHttpClient": useProxy:=FALSE and useWinHTTP=FALSE).
Web Sockets are upgraded HTTP connections, which can be used to send and
receive Web Socket "Frames" at any time after the connection was upgraded,
using a TCP/IP connection previously established for HTTP communication,
while at the cost of LOSING the ability to send or receive HTTP requests
and responses through that same connection.
Unlike HTTP, which follows a strict Request->Response communication scheme,
a Web Socket is fully bi-directional and allows either side to send and
to receive data (Frames) at the same time. This is true for the Client
as well as Server, allowing free communication flow in both directions.
The down-side of Web Sockets is that most HTTP Proxy Servers do NOT
support the Web Socket upgrade protocol and block Web Socket data.
To learn more about working with Web Sockets using the RTC SDK,
check out the new "Web Socket" Test Projects (Client and Server)
in the "SDKExamples_QuickStart_VCL" Project Group, which demonstrate
how to upgrade a HTTP connection to a Web Socket connection on the
Client and the Server and how to send and receive Web Socket "Frames".