How does js maintain an online audience list

the company does live broadcasting related projects. There is a list of online viewers. updates in real time , which is maintained on the page by the front end

.

the current practice is to write a structure with push, remove, sort, sync , responsible for entry, exit, sorting, synchronization.

when someone comes in, push to the end. When you go out, there is only id, so you need to find (). Sorting will be performed during synchronization. There are two strategies for synchronization: one is timing synchronization, and the other is push or remove will perform synchronization.

  1. has already used virtual lists, otherwise tens of thousands of pieces of data will be displayed and the client memory will explode.
  2. one idea is to delete the sort operation, confirm the general location with insertion sorting and bisection retrieval, and then traverse it.

would you like to ask if there are any other optimization points? Or other mature solutions.

Jun.01,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e9a5-2c42e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e9a5-2c42e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?