当前位置:网站首页>Interpretation of websocket protocol -rfc6455
Interpretation of websocket protocol -rfc6455
2022-07-24 10:07:00 【Cloudy summer】
1.webscoket
2. handshake handshake(open, close)
3. send data :3 Methods
4. To break off : Protocol layer +tcp close()
1.webscoket
visit :ws://192.168.232.128:8888
agreement Address port
How to judge is websocket:Upgrade:websocket
from Sec-WebSocket-Key To Sec-WebSocket-Accpet:
//1.request:
//Upgrade:websocket Distinguish the agreement
//Sec-WebSocket-Key: identity base64
//2.response:
//Sec-WebSocket-Accpet:
// Why add public GUID RFC4122 On . Role of filling
//1. from Sec-WebSocket-Key To Sec-WebSocket-Accpet:
// step :1.key Character splicing key=Sec-WebSocket-Key+GUID
// 2. Hash sha=SHA-1(key)
// 3.base64 The coding base64(sha);
2. handshake handshake(open close)
Why shake hands ? There has been a TCP 了 .
Multiple protocols coexist
compatible http webserver
Verify whether the identities of both parties are legal
3. send data
3.1 Message header definition :

According to the data length , The format of the header :
General data length : <126 when :6 individual
=126 when :8 individual
==127 when :14 individual

6:
8: More 2,3 Two bytes
14:
3.2 The longest number of data sent :73bits![]()
3.3 Plaintext or ciphertext :
mask Is it 1.
If it's ciphertext , The calculation is as follows :
3.4 Read 3 Ways of planting :
4. To break off :
Why disconnect ? Because a lot of close_wait
Method : application layer websocket-->fin;// Protocol layer
tcp close(); //tcp4 Second wave
边栏推荐
- How to solve the problem of robot positioning and navigation in large indoor scenes with low-cost solutions?
- note: expected ‘void * (***)(void ***)’ but argument is of type ‘void (*)(void *)’
- Implementation and traversal of binary tree and binary tree sorting tree
- Spark Learning: using RDD API to implement inverted index
- Cyclicbarrier and countdownlatch [concurrent programming]
- Spark Learning: build SQL to meet the specified optimization rules
- Exception: pyqtgraph requires Qt version >= 5.12 (your version is 5.9.5)
- 聚集日志服务器
- Server load and CPU performance tuning
- Arduino drive Lora module node
猜你喜欢

Do you really understand the concept of buffer? Take you to uncover the buffer zone~

What is the cloud native mid platform business architecture?

What if path is deleted by mistake when configuring system environment variables?
![[STM32 learning] (22) STM32 realizes 360 degree rotary encoder](/img/8e/fb036296ec3aff5e60acee5018943c.png)
[STM32 learning] (22) STM32 realizes 360 degree rotary encoder

What's the difference between testing / developing programmers' professionalism and salted fish? They don't want to be excellent coders?

An article takes you to understand the operation of C language files in simple terms

二叉树、二叉树排序树的实现及遍历
![Raspberry Pie: [failed] failed to start /etc/rc local Compatibility.](/img/c3/d648cea4e8eef20a221dc034ecfc1d.png)
Raspberry Pie: [failed] failed to start /etc/rc local Compatibility.

【机器人学习】机构运动学分析与matlab仿真(三维模型+word报告+matlab程序)

The most complete solution for distributed transactions
随机推荐
Is CITIC Securities a safe and reliable securities firm? How to open an account?
Compilation and linking of programs
PHP Basics - session control - Session
[STM32 learning] (6) use of serial port 1 (usart1)
Basic SQL operations
Countdownlatch and join [concurrent programming]
Implementation principle of acid in MySQL
The best time to buy and sell stocks Ⅳ (leetcode-188)
Add SSH key to bitbucket
[STM32 learning] (9) stm32f1 general timer realizes simple breathing lamp
System a uses window.open to call system B, and system B carries data back to system a after processing the business
Wechat applet
Synchronized scope "concurrent programming"
[example] v-contextmenu right click menu component
This article takes you to understand the dynamic memory allocation of C language
[STM32 learning] (8) stm32f1 general timer configuration
Color recognition of regions of interest in pictures and videos based on OpenCV
The concept and representation of a tree
The optimal time to buy and sell stocks includes the freezing period (leetcode-309)
Getting started with identityserver4