当前位置:网站首页>Day2 websocket+ sort
Day2 websocket+ sort
2022-07-24 06:06:00 【lonelyMangoo】
Today's summary
- use WebSocket It realizes the function of recording the mouse position of each online user
- Quick sort and heap sort
WebSocket
WebSocket You can actively send or receive data to the other party , It's like Socket equally ; also WebSocket It needs to be similar TCP The client and server are connected by handshake , Only after the connection is successful can we communicate with each other , yes h5 Start by offering one in a single TCP Full duplex protocol on the connection . Consider real-time , Allow the server to send code to the client .
WebSocket The main solution is the problem of real-time communication , If http You can only use asynchronous polling . But it is inefficient and a waste of time , however WebSocket After the connection is established, it is particularly silky ,
The main method
@OnOpen: Operations during connection establishment
@OnMessage: Be able to use the received message
@OnClose: Operation when closing
At the same time, the whole process can also send information through the following code
RemoteEndpoint.Basic basicRemote = mouseMoveEndPoint.session.getBasicRemote();
basicRemote.sendText(s);
The front end I use is JQuery,
It feels very silky to accept .
The business process
First, I wrote a simple landing page (springboot Written ), After logging in successfully, save the information session(http Of session) For the following simple judgment .
Then is WebSocket Part of , This part is actually crud, Just familiar with WebSocket Use .
Finally, the front end ,WebSocket The operation is almost the same as that of the back end , So it's still very silky ,JQeury I'm not very familiar with it .
The effect is to login in different browsers , Move the mouse to see the change of the mouse position of each browser . The video doesn't seem to play , Forget it .
Sort
I wrote fast sorting and heap sorting all night ... I'm crying , I hope I can finish all the sorting tomorrow , Then we'll sum up together .
reflection
- The foundation is too poor , I have learned to write by dictation before fast sorting and heap sorting , As a result, I forgot it so clean after a long time … Next time you need to look at what it is before writing code , Don't read the concept again in the middle of writing , As a result, more time was wasted .
- Today, because of writing sorting , I didn't have time to see jvm.
- understand WebSocket after , Now I want to write a little game that you draw and I guess to practice my hand , Then I want to use socket+http Simulate a server .
- Still too impetuous , Always can't walk, thinking of running directly , Today's sorting is … Write WebSocket Of demo It's also .
- Linux Take it with you .
边栏推荐
- KMP代码分布详解
- 【FatFs】手动移植FatFs,将SRAM虚拟U盘
- Vscode multiline comments always expand automatically
- Openwrt quick configuration Samba
- [deep learning] handwritten neural network model preservation
- Chapter 5 neural network
- 【数据库系统原理】第四章 高级数据库模型:统一建模语言UML、对象定义语言ODL
- In GCC__ attribute__ ((constructor) and__ attribute__ ((destructor)).
- Machine learning (Zhou Zhihua) Chapter 3 Notes on learning linear models
- QT novice entry level calculator addition, subtraction, multiplication, division, application
猜你喜欢

Common features of ES6

Machine learning (zhouzhihua) Chapter 5 notes on neural network learning

PDF Text merge

JUC并发编程基础(8)--读写锁

JUC并发编程基础(9)--线程池

JUC并发编程基础(7)--多线程锁

论文阅读-Endmember-Guided Unmixing Network (EGU-Net) 端元指导型高光谱解混网络

Machine learning (Zhou Zhihua) Chapter 4 notes on learning experience of decision tree

JUC并发编程基础(6)--Lock锁

Qt新手入门级 计算器加、减、乘、除、应用
随机推荐
Demo of UDP communication applied to various environments
JUC并发编程基础(7)--多线程锁
PyTorch 单机多卡分布式训练
The problem that the user name and password are automatically filled in when Google / Firefox manages the background new account
YOLOv5学习总结(持续更新)
Search of two-dimensional array of "sword finger offer" C language version
day6-jvm
Conversion of world coordinate system, camera coordinate system and image coordinate system
Installation of tensorflow and pytorch frames and CUDA pit records
Iotp2pgate two IOT devices point-to-point communication fast implementation scheme
"Statistical learning methods (2nd Edition)" Li Hang Chapter 14 clustering method mind map notes and after-school exercise answers (detailed steps) K-means hierarchical clustering Chapter 14
Draw contour cv2.findcontours function and parameter interpretation
Qt char型转QString型 16进制与char型 转 16进制整型
Machine learning (zhouzhihua) Chapter 1 Introduction notes learning experience
解决ModularNotFoundError: No module named “cv2.aruco“
《剑指Offer》 二维数组的查找 C语言版本
【FatFs】手动移植FatFs,将SRAM虚拟U盘
JDBC初级学习 ------(师承尚硅谷)
Vscode multiline comments always expand automatically
[FatFs] migrate FatFs manually and transfer SRAM virtual USB flash disk