当前位置:网站首页>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 .
边栏推荐
- 【深度学习】手把手教你写“手写数字识别神经网络“,不使用任何框架,纯Numpy
- 如何解决训练集和测试集的分布差距过大问题
- 主成分分析计算步骤
- Official account development custom menu and server configuration are enabled at the same time
- Typora installation package in November 2021, the last free version of the installation package to download v13.6.1
- DeepSort 总结
- bat批处理脚本、同时运行多个文件、按照顺序执行的批处理命令及xshell脚本。
- systemctl + journalctl
- es6常用特性
- 通道注意力与空间注意力模块
猜你喜欢

jestson安装ibus输入法
![[FatFs] migrate FatFs manually and transfer SRAM virtual USB flash disk](/img/fb/5f3d17f1f3d6e4979ece5126e2925e.png)
[FatFs] migrate FatFs manually and transfer SRAM virtual USB flash disk

MySQL download and installation environment settings

"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

The problem that the user name and password are automatically filled in when Google / Firefox manages the background new account

HAL_ Delay() delay error about 1ms

day6-jvm

JDBC初级学习 ------(师承尚硅谷)

Qt新手入门级 计算器加、减、乘、除、应用

synergy局域网实现多主机共享键鼠(amd、arm)
随机推荐
day-7 jvm完结
Sequential stack C language stack entry and exit traversal
Chapter III summary of linear model
Write the list to txt and directly remove the comma in the middle
vscode 多行注释总是会自动展开的问题
世界坐标系、相机坐标系和图像坐标系的转换
[raspberry pie 4B] VII. Summary of remote login methods for raspberry pie xshell, putty, vncserver, xrdp
JUC并发编程基础(4)--线程组和线程优先级
JUC并发编程基础(9)--线程池
Xshell远程访问工具
Draw contour cv2.findcontours function and parameter interpretation
Use QT to connect to MySQL and create table numbers, write data, and delete data
Paper reading endmember guided unmixing network (EGU net)
Official account development custom menu and server configuration are enabled at the same time
数组常用方法
[MYCAT] Introduction to MYCAT
Channel attention and spatial attention module
头歌 平台作业
"Statistical learning methods (2nd Edition)" Li Hang Chapter 17 latent semantic analysis LSA LSI mind mapping notes and after-school exercise answers (detailed steps) Chapter 17
Jupyter notebook选择conda环境