Comments (2)
websocket协议
WebSocket 协议在2008年诞生,2011年成为国际标准。目前已基本被所有浏览器支持(过旧版本的浏览器会不支持)。
websocket协议允许客户端和服务端之间建立全双工通信,以便消息可以从任意一端发送到另一端,另外websocket只需建立一次长连接,连接建立后,消息可以随时在连接通道上进行传递。相比于轮询方式的大量请求效率大大提高。
优点:
- 只需建立一次连接,效率高,性能消耗低。
- 长连接,连接建立后,随时可以进行通信。
- 全双工,消息可以从客户端和服务端任意发起。
- 实时性好,减少了轮询间隔的时延。
- 不受同源策略限制,客户端可以与任意服务端申请建立连接(不一定是优点,需要考虑安全问题)
from keeplearning.
websocket使用案例
腾讯文档
图片
http轮询
from keeplearning.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keeplearning.