当前位置:网站首页>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 .
边栏推荐
- day4-jvm
- Draw contour cv2.findcontours function and parameter interpretation
- Demo of UDP communication applied to various environments
- JDBC初级学习 ------(师承尚硅谷)
- Common features of ES6
- day1-jvm+leetcode
- [MYCAT] Introduction to MYCAT
- [activiti] Introduction to activiti
- Numpy array broadcast rule memory method array broadcast broadcast principle broadcast mechanism
- [MYCAT] MYCAT sub database and sub table
猜你喜欢

A small problem in labelme to VOC code

世界坐标系、相机坐标系和图像坐标系的转换
![[activiti] gateway](/img/8c/c89ec6c4c5871a32218ddadfd8beba.png)
[activiti] gateway

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

MySQL foundation - constraints

【FatFs】手动移植FatFs,将SRAM虚拟U盘

DeepSort 总结

Chapter 5 neural network
![[USB host] stm32h7 cubemx porting USB host with FreeRTOS to read USB disk, usbh_ Process_ The OS is stuck. There is a value of 0xa5a5a5](/img/be/b7723920f0e81e8699bb26dd1c0fe5.png)
[USB host] stm32h7 cubemx porting USB host with FreeRTOS to read USB disk, usbh_ Process_ The OS is stuck. There is a value of 0xa5a5a5
![[raspberry pie 4B] VII. Summary of remote login methods for raspberry pie xshell, putty, vncserver, xrdp](/img/dc/364fdc4c1748cc5522e4592bc47dc3.png)
[raspberry pie 4B] VII. Summary of remote login methods for raspberry pie xshell, putty, vncserver, xrdp
随机推荐
A small problem in labelme to VOC code
QT novice entry level calculator addition, subtraction, multiplication, division, application
原生js放大镜效果
[deep learning] handwritten neural network model preservation
tensorflow和pytorch框架的安装以及cuda踩坑记录
Better CV link collection (dynamic update)
JVM系统学习
jupyter notebook一直自动重启(The kernel appears to have died. It will restart automatically.)
‘Results do not correspond to current coco set‘
"Statistical learning methods (2nd Edition)" Li Hang Chapter 13 introduction to unsupervised learning mind map notes
Openwrt quick configuration Samba
AD1256
JVM system learning
day1-jvm+leetcode
systemctl + journalctl
Qt新建工程简介
[MYCAT] MYCAT installation
【深度学习】手写神经网络模型保存
使用Qt连接MySql并创建表号、写入数据、删除数据
Chapter IV decision tree summary