当前位置:网站首页>Websocket learning

Websocket learning

2022-06-24 23:16:00 @Have a cup of coffee

Reference material :

      Theoretical basis -

websocket im _ which Zha's blog -CSDN Blog _websocket im Catalog one 、websocket Introduction II 、 Background III 、 advantage 1、 Control spending 2、 More real time 3、 Keep connected 4、 Better binary support 5、 Support expansion and better compression effect 、 principle 1、 client 、 Server setup TCP Connect , Three handshakes .2、TCP After successful connection , Client pass HTTP The protocol is delivered to the server websocket Supported version number information .( Before you start HTTP handshake )3、 After the server receives the client's handshake request , Same use HTTP Protocol feedback data .4、 After receiving the message that the connection was successful , adopt TCP Channel for transmission communication . 5、 ... and 、websocket and socket Relationship 6 、SuperWebSocket Implementation services https://blog.csdn.net/guorui_java/article/details/122141783       Code example -

Java Integrate socket.io_ A blog where morning flowers never fade -CSDN Blog _java socketio Foreword this article is based on SpringBoot2.2.6, Integrate netty-socketio rely on <dependency><groupId>com.corundumstudio.socketio</groupId><artifactId>netty-socketio</artifactId><version>1.7.7</version></dependency><dependency>&lhttps://blog.csdn.net/Curtisjia/article/details/118034542

socketio yes websocket A library , For native websocket It was packaged .

Don't just think about single machines , Our actual machines are 【 colony 】 Deploy . Then we need to consider - Where should the connection between the client and the server exist ??

1、 adopt ip-hash Distribute ;

2、 adopt redis And so on ;

3、 The client carries it by itself ;-- Does not fit this scenario . If you just do a login authentication , You can use jwt It can be carried by the client itself token.

原网站

版权声明
本文为[@Have a cup of coffee]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241744227934.html