当前位置:网站首页>[TiO websocket] v. TiO websocket server counts the number of online people
[TiO websocket] v. TiO websocket server counts the number of online people
2022-06-11 09:21:00 【Asurplus、】
In daily business , We often need to count the current number of online people , That is, connected websocket How many users are there , Discover... By reading the source code , stay org.tio.core Under the bag TioConfig The object of counting the number of people can be found in the file
1、 Source code interpretation

We can see that org.tio.core.TioConfig A large amount of data is recorded in the file , for example : The startup time of the system , Ben jvm All of the TioConfig object , Heartbeat timeout and other data , Look down , You can see there's one users object , The connection is recorded here websocket All objects of ,Users What exists in this class mapWithLock Constant , It is used to record the connection information of users , And provides getMap() Method , In this way, we can easily get the real-time online number in the system
2、 Get real-time online people
- 1、 First, get the configuration file
// Get profile
ServerTioConfig serverTioConfig = WebSocketConfig.serverTioConfig;
We have already described how to get global data t-io Configuration file for , Get it directly
- 2、 Get start time
// System start time
long startTime = serverTioConfig.startTime;
- 3、 Get real-time online people
// Real time online population
int users = serverTioConfig.users.getMap().size();
- 4、 obtain group Number of groups
// Number of live groups
int groups = serverTioConfig.groups.getGroupmap().size();
Need to obtain other statistics , You can read the source code
If you find deficiencies in reading , Welcome to leave a message !!!
边栏推荐
- 报错RuntimeError: BlobReader error: The version of imported blob doesn‘t match graph_transformer
- 【软件】ERP体系价值最大化的十点技巧
- 报错[error] input tesnor exceeds available data range [NeuralNetwork(3)] [error] Input tensor ‘0‘ (0)
- 1400. construct K palindrome strings
- Openstack explanation (21) -- installation and configuration of neutron components
- Video review pulsar summit Asia 2021, cases, operation and maintenance, ecological dry goods
- 企业需要考虑的远程办公相关问题
- Comment l'entreprise planifie - t - elle la mise en oeuvre?
- 【方案设计】基于单片机开发的家用血氧仪方案
- 2095. delete the intermediate node of the linked list
猜你喜欢

考研數學 【數列極限證明題】題型方法總結

Comparison and introduction of OpenCV oak cameras

kubelet Error getting node 问题求助

openstack详解(二十一)——Neutron组件安装与配置
![[C language - function stack frame] analyze the whole process of function call from the perspective of disassembly](/img/c5/40ea5571f187e525b2310812ff2af8.png)
[C language - function stack frame] analyze the whole process of function call from the perspective of disassembly
![报错[DetectionNetwork(1)][warning]Network compiled for 6 shaves,maximum available 10,compiling for 5 s](/img/54/f42146ae649836fe7070ac90f2160e.png)
报错[DetectionNetwork(1)][warning]Network compiled for 6 shaves,maximum available 10,compiling for 5 s

OpenCV OAK-D-W广角相机测试

Identifier keyword literal data type base conversion character encoding variable data type explanation operator

Device = depthai Device(““, False) TypeError: _init_(): incompatible constructor arguments.

MSF adds back door to normal program
随机推荐
A summary of the problem type and method for proving the limit of sequence in postgraduate entrance examination
2161. divide the array according to the given number
剑指 Offer II 041. 滑动窗口的平均值
Award winning survey streamnational sponsored 2022 Apache pulsar user questionnaire
Error [error] input tesnor exceeded available data range [neuralnetwork (3)] [error] input tensor '0' (0)
Opencv oak-d-w wide angle camera test
【分享】企業如何進行施行規劃?
206. reverse linked list
Some learning records I=
Fabric.js 動態設置字號大小
20. valid brackets
Machine learning notes - convolutional neural network memo list
ArcGIS 10.9.1 地质、气象体元数据处理及服务发布调用
Type-C蓝牙音箱单口可充可OTG方案
MSF基于SMB的信息收集
Machine learning notes - in depth Learning Skills Checklist
[C language - Advanced pointer] mining deeper knowledge of pointer
Customize PCBA scheme and develop wrist sphygmomanometer scheme
Strength and appearance Coexist -- an exclusive interview with Liu Yu, a member of Apache pulsar PMC
制作业信息化为什么难施行?